HEX to RGB

Enter a HEX code, preview the color, and copy RGB channels, CSS rgb(), or HSL output.

99, 102, 241
rgb(99, 102, 241)
hsl(239, 84%, 67%)

Enter a valid HEX color such as #6366F1 or #636.

What HEX to RGB Does

HEX to RGB converts a hexadecimal color code into red, green, and blue channel values. A HEX color stores the same color information as pairs of hexadecimal characters, while RGB expresses that color as decimal channel values. The converter reads the entered HEX value, shows a live preview, and displays the matching RGB channels, CSS rgb() function, and HSL output.

HEX to RGB is useful when a compact color code needs to become channel data for CSS, JavaScript, design documentation, chart settings, or color calculations. The main result gives the plain RGB numbers, while the secondary cards provide a complete CSS rgb() value and an HSL version. Copy buttons beside the outputs help preserve commas, parentheses, spacing, and technical casing.

The visible input accepts a HEX code, normalizes valid values when the field loses focus, and shows an error state for invalid input. A hue slider can explore a related color from the current value, Random creates another valid HEX input, and Clear removes the current value so a new code can be entered cleanly.

How to Use HEX to RGB

  1. Enter a HEX color code in the HEX Code field.
  2. Check the color preview to confirm that the entered code represents the expected color.
  3. Copy the main RGB result when the destination needs plain red, green, and blue channel numbers.
  4. Copy the CSS rgb() output when a stylesheet or CSS variable needs a complete color function.
  5. Copy the HSL output when hue, saturation, or lightness will be compared or adjusted next.
  6. Move the hue slider only when you want to explore a related color before copying a new result.
  7. Use Random when another valid HEX example is useful for testing.
  8. Use Clear before replacing the current value with a new HEX input.

HEX to RGB Output Formats

OutputExampleRecommended use
RGB channels99, 102, 241Use when a script, data field, or calculation expects separate channel numbers.
CSS rgb()rgb(99, 102, 241)Use directly in CSS properties, variables, and inline style values.
HSLhsl(239, 84%, 67%)Use when the next edit should change hue, saturation, or lightness.
PreviewVisible color cardUse as a visual confirmation before copying the converted value.

A HEX to RGB converter changes the format of the color, not the color itself. The same visible color can be represented as HEX, RGB, CSS rgb(), or HSL. Choosing the correct output depends on whether the next task needs compact notation, separate channels, a complete CSS function, or a color model that is easier to adjust.

When HEX to RGB Is Useful

  • CSS work: convert a HEX code into a CSS rgb() function when a project uses RGB syntax.
  • JavaScript color logic: extract channel values for calculations, generated previews, sliders, or dynamic styles.
  • Design documentation: list both HEX and RGB values so designers and developers can refer to the same color.
  • Palette cleanup: translate legacy HEX values into RGB notation before organizing tokens or naming rules.
  • Color comparison: inspect channels to see whether two colors differ mostly in red, green, or blue.

When the original color is already described by channel numbers, use RGB to HEX for the reverse conversion. When a color needs to be chosen visually before conversion, use Color Picker to select the color and then copy the format needed for the next step.

Valid HEX Input Notes

A standard six digit HEX color uses two characters for red, two for green, and two for blue. For example, #6366F1 separates into 63, 66, and F1, which convert to the RGB channels 99, 102, and 241. The number sign is common in CSS, but the important requirement is that the color value resolves to valid hexadecimal characters.

Input conditionExpected behaviorWhat to do
Valid HEX codeThe preview and outputs update to the converted color.Copy the output format that matches the destination.
Missing or invalid charactersThe result shows an invalid HEX state.Check the length and remove characters outside 0 to 9 and A to F.
Lowercase lettersThe value can still represent a valid HEX color.Review the normalized value and preview after leaving the field.
Exploratory hue changeThe hue slider generates a related valid color.Use it for exploration, not for preserving an approved source value.

Choosing the Right RGB Result

The plain RGB channel result is most appropriate when another control expects three separate numbers. The CSS rgb() result is better when the value will be pasted directly into a stylesheet. The HSL result is useful when the next edit will adjust lightness or saturation rather than individual red, green, and blue channels.

HEX to RGB also helps explain why two colors look similar or different. A small change in one channel can create a subtle adjustment, while larger changes across several channels usually produce a stronger visual shift. Reviewing the converted channels before copying can reveal whether a color is mostly neutral, warm, cool, light, dark, muted, or highly saturated.

Using HEX to RGB in CSS and Code

HEX to RGB is useful when a codebase or design system stores colors as HEX but another part of the implementation needs channel values. A JavaScript function may need red, green, and blue numbers for calculations, while a stylesheet may need a complete CSS rgb() function. Copying the matching output avoids hand converting each pair of hexadecimal characters.

CSS work can require either notation. HEX is compact for solid colors, while rgb() can be easier to combine with generated values, custom properties, or tooling that already works with channel data. The converter keeps both formats visible so the same source color can be reused without changing the underlying value.

When the input comes from a brand guide, component library, or token file, convert the approved value first before touching the hue slider. The hue slider is useful for exploration, but it intentionally changes the color. Keeping conversion and exploration separate prevents an approved HEX value from being altered during routine implementation work.

Practical HEX Conversion Checks

When comparing values across tools, remember that casing does not change a HEX color. #6366F1 and #6366f1 represent the same value, but documentation may prefer one style for consistency. The converted RGB numbers are a better way to verify whether two HEX strings truly describe the same color.

SituationWhat to enterWhat to copy
Brand guide provides HEXThe approved six digit codeRGB channels for documentation or implementation notes
CSS needs an RGB functionThe source HEX valueCSS rgb() output
Script needs channel valuesThe source color codePlain RGB numbers
Color needs visual confirmationThe pasted HEX valuePreview first, then copy the required output

Precise conversion is especially useful when two colors are visually close. The RGB channels can show whether the difference is a small shift in one channel or a larger shift across several channels. That makes review comments more specific and reduces the chance of replacing the wrong token.

Before Copying Converted RGB Values

Before copying a converted result, decide whether the next destination needs plain channels or a complete CSS function. Plain values are useful for calculations, but a stylesheet usually needs the full rgb() syntax. Checking the destination first prevents a correct conversion from being pasted in the wrong format.

If a value is invalid, correct the source HEX code instead of copying placeholder output. The error state is a signal to verify length, characters, and source accuracy before the color is reused elsewhere. That final check is especially useful when values are copied from screenshots, PDFs, or older documentation in shared project files.

Common HEX Conversion Mistakes

  • Missing digits: a HEX value that is too short cannot describe all three RGB channels reliably.
  • Invalid characters: letters outside A through F are not valid hexadecimal digits.
  • Copying plain channels into CSS: use the CSS rgb() output when the destination needs a complete function.
  • Mixing conversion directions: HEX to RGB starts from a HEX code, while RGB to HEX starts from channel numbers.
  • Ignoring the preview: the preview is the fastest way to catch a pasted value that does not match the expected color.

HEX to RGB is most reliable when the source HEX code is exact. Enter the approved code, check the preview, copy the output format that matches the destination, and keep conversion separate from creative color exploration when working with brand or production color values.

Copied