HEX to RGB
Enter a HEX code, preview the color, and copy RGB channels, CSS rgb(), or HSL output.
Enter a HEX code, preview the color, and copy RGB channels, CSS rgb(), or HSL output.
99, 102, 241rgb(99, 102, 241)hsl(239, 84%, 67%)Enter a valid HEX color such as #6366F1 or #636.
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.
rgb() output when a stylesheet or CSS variable needs a complete color function.| Output | Example | Recommended use |
|---|---|---|
| RGB channels | 99, 102, 241 | Use 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. |
| HSL | hsl(239, 84%, 67%) | Use when the next edit should change hue, saturation, or lightness. |
| Preview | Visible color card | Use 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.
rgb() function when a project uses RGB syntax.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.
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 condition | Expected behavior | What to do |
|---|---|---|
| Valid HEX code | The preview and outputs update to the converted color. | Copy the output format that matches the destination. |
| Missing or invalid characters | The result shows an invalid HEX state. | Check the length and remove characters outside 0 to 9 and A to F. |
| Lowercase letters | The value can still represent a valid HEX color. | Review the normalized value and preview after leaving the field. |
| Exploratory hue change | The hue slider generates a related valid color. | Use it for exploration, not for preserving an approved source value. |
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.
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.
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.
| Situation | What to enter | What to copy |
|---|---|---|
| Brand guide provides HEX | The approved six digit code | RGB channels for documentation or implementation notes |
| CSS needs an RGB function | The source HEX value | CSS rgb() output |
| Script needs channel values | The source color code | Plain RGB numbers |
| Color needs visual confirmation | The pasted HEX value | Preview 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 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.
rgb() output when the destination needs a complete function.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.