HEX to RGB — Convert HEX Color Codes to RGB Values
Convert HEX color codes to RGB values. Live swatch preview, runs entirely in your browser. No uploads, no accounts, no limits.
HEX to RGB
Convert HEX color codes to RGB values online. Enter a hex code like #ff6600 and get R, G, B values instantly.
HEX and RGB are the two ways the web describes color, and they describe the same color. The HEX code #3B82F6 is six characters: 3B, 82, F6. Each pair is a hex (base-16) number that maps to a decimal value: 3B is 59, 82 is 130, F6 is 246. The RGB triplet is rgb(59, 130, 246) — three decimal numbers from 0 to 255, one for each color channel. The two notations are interchangeable; a stylesheet using color: #3B82F6 and a stylesheet using color: rgb(59, 130, 246) produce the exact same rendered color on every browser. The choice is style, not substance.
The non-obvious thing about HEX-to-RGB is when the two notations are not equivalent. HEX can express alpha (#3B82F680 is 50% opacity), and the conversion to RGBA keeps the alpha as a separate channel. Some legacy CSS and image processing libraries only accept rgb(59, 130, 246) without alpha — for those, drop the alpha or use a separate opacity property. The reverse case (RGB without alpha to HEX) is also asymmetric: a HEX code is always 6 or 8 hex digits, and the conversion adds the # prefix by convention. The tool handles both directions of this asymmetry and shows the RGBA output when alpha is present.
For a final hand-off: if the goal is writing modern CSS, both HEX and RGB work — most developers pick one and stick with it. HSL is the more readable form for picking tints and shades. If the goal is matching a design tool’s output, the RGB string is what Figma, Sketch, and Adobe XD export as ‘RGB’ in their color panels. If the goal is processing color in JavaScript (canvas, WebGL, image manipulation), RGB is the native form — the canvas API takes RGB triplets, and converting HEX to RGB before passing to the canvas is the standard pattern.
How to use
Enter a HEX code
Type a 3-digit HEX (#3B8) or 6-digit HEX (#3B82F6) into the input. The input is auto-prefixed with # if you omit it, and short-form HEX is expanded to long-form before parsing.
Read the RGB breakdown
The output shows red, green, and blue channels (0-255 each). The live swatch on the right updates as you type, so you can see the color in real time. The detected sRGB color space is shown in the footer.
Copy the RGB string
Copy the value as a CSS-ready `rgb(59, 130, 246)` or `rgba(59, 130, 246, 1)` declaration. Paste it into a stylesheet, a design tool, or a CSS-in-JS template literal.
Frequently asked
What is RGB used for?
RGB (Red, Green, Blue) is the additive color model used by every screen, projector, and digital camera. Each pixel is described by the intensity of its red, green, and blue subpixels, with values from 0 (no light) to 255 (maximum light). It is the native color model for HTML canvas, WebGL, and most image formats.
Is the conversion lossless?
Yes — HEX and RGB are the same color in different notations. HEX is RGB expressed in base-16 (each pair of hex digits is one channel, 00-FF). The conversion is a base conversion, not a transformation. The output is mathematically identical to the input.
What does the alpha channel do?
Toggle alpha to add an opacity slider (0-100%). The output includes RGBA values. The HEX input needs to be 8 digits to carry alpha (#3B82F680) — a 6-digit HEX has no alpha and assumes 100% opacity in the RGBA output.
Why does my screen show a different color than the HEX value?
Screens are not calibrated identically. A HEX value of #3B82F6 is exactly the same sRGB color on every device, but the rendered color depends on the display's color profile, brightness, and ambient light. Two monitors can show visibly different blues for the same HEX code.
Can I enter HSL values instead?
The HEX-to-RGB tool accepts HEX input specifically. For HSL input, use the Color Converter tool, which accepts HEX, RGB, HSL, and CMYK in one interface and shows all four simultaneously. The underlying conversion is the same.
Limitations
- sRGB onlyThe tool assumes sRGB color space, which is the default for the web. HEX codes that reference Display P3 or Rec.2020 colors (rare, used in some Apple design tools) are treated as sRGB, which clips out-of-gamut values to the nearest sRGB color.
- No wide-gamut outputRGB output is always 0-255 per channel, which is the sRGB range. For wide-gamut colors that need more than 8 bits per channel, use a tool that emits 16-bit per channel values (rare in web contexts).
- No CMYK outputThe tool outputs HEX and RGB, not CMYK. For print colors, use the Color Converter which adds CMYK. CMYK is a subtractive model for ink on paper, not a screen model, and the conversion from sRGB to CMYK is approximate.
Platform notes
- macOS
- Digital Color Meter (in Applications > Utilities) reads the color under the cursor and shows RGB. The browser tool is the right pick for converting a HEX code from a design file to RGB, which some legacy CSS and older image processing libraries require.
- Windows
- PowerToys' Color Picker reads any pixel on screen and copies the value as HEX, RGB, or HSL. The browser tool is the right pick for HEX values from a design file, a Figma export, or a CSS file that need to become RGB triplets.
- Linux
- GIMP's color picker shows HEX and RGB. The browser tool is the right pick for batch conversion of HEX codes from a CSS file, a design export, or a configuration value. For command-line work, ImageMagick's `convert -size 1x1 xc:'#3B82F6' -format '%[pixel:p{0,0}]' info:` does the same.
- Web
- Runs entirely client-side. Works offline once the page has loaded. The RGB output is a valid CSS color value — paste it into any stylesheet, CSS-in-JS template, or design tool that supports the RGB syntax.