Color Conversion Tools
HEX to RGB
Turn a HEX color code into its red, green and blue channels. Paste a token such as #1e90ff, see the color, and copy the rgb() value along with HSL, HSV, CMYK and OKLCH. Nothing leaves your browser.
Edit a channel and see the color result immediately.
Enter HEX
Enter #RGB or #RRGGBB. These pair converters use opaque colors.
RGB result
The conversion runs in your browser.
All formats
- HEX
#336699- RGB
rgb(51, 102, 153)- HSL
hsl(210, 50%, 40%)- HSV
hsv(210°, 66.7%, 60%)- CMYK
cmyk(66.7%, 33.3%, 0%, 40%)- OKLCH
oklch(49.9% 0.099 250.4)- CSS
≈ steelblue
Tints and shades
Text contrast (WCAG)
Normal text needs 4.5:1 for AA and 7:1 for AAA; large text needs 3:1.
How it was calculated
R = 33₁₆ = 3 × 16 + 3 = 51G = 66₁₆ = 6 × 16 + 6 = 102B = 99₁₆ = 9 × 16 + 9 = 153
Common colors in HEX and RGB
Choose a color to load it into the converter.
| Color | HEX | RGB |
|---|---|---|
#000000 | rgb(0, 0, 0) | |
#ffffff | rgb(255, 255, 255) | |
#ff0000 | rgb(255, 0, 0) | |
#00ff00 | rgb(0, 255, 0) | |
#0000ff | rgb(0, 0, 255) | |
#ffff00 | rgb(255, 255, 0) | |
#00ffff | rgb(0, 255, 255) | |
#ff00ff | rgb(255, 0, 255) | |
#808080 | rgb(128, 128, 128) | |
#800000 | rgb(128, 0, 0) | |
#008000 | rgb(0, 128, 0) | |
#000080 | rgb(0, 0, 128) | |
#ffa500 | rgb(255, 165, 0) | |
#4682b4 | rgb(70, 130, 180) | |
#663399 | rgb(102, 51, 153) | |
#ff6347 | rgb(255, 99, 71) |
How to use
- Paste or type a three- or six-digit HEX code, with or without the leading #, or pick a color with the swatch button.
- Read the rgb() result and check the matching preview; the calculation panel shows how each pair of hex digits becomes a channel.
- Copy the RGB value, or copy any other notation from the All formats panel, then use Swap direction if you need to go back.
Examples
A six-digit brand blue
Each pair of hex digits is one channel: 1e is 1 × 16 + 14 = 30, 90 is 9 × 16 = 144 and ff is 15 × 16 + 15 = 255.
#1e90ff
rgb(30, 144, 255)
A three-digit shorthand
Shorthand doubles every digit before converting, so #0af is read as #00aaff. The a becomes aa, which is 170.
#0af
rgb(0, 170, 255)
Why convert HEX to RGB
HEX codes are what most people copy: from a brand guide, a Figma inspector, a CSS variable or a screenshot picker. RGB is what you need when you work with the channels themselves. Typical reasons:
- Adding transparency in CSS. Modern CSS writes alpha next to the channels, so
#1e90ffbecomesrgb(30 144 255 / 40%)for an overlay. - Canvas, WebGL and image code. Pixel buffers store red, green and blue bytes. Comparing a pixel to a brand color is easier when both are numbers.
- Debugging a theme. If two buttons look slightly different, the channel values show which component is off and by how much.
- Spreadsheets and data tools. Charting libraries and Excel’s color dialogs often ask for three numbers rather than a hex string.
How the conversion works
A six-digit HEX code is three bytes written in base 16. Split it into pairs: RR GG BB. Each pair converts to decimal with first digit × 16 + second digit, where a to f stand for 10 to 15. For #1e90ff:
1e→ 1 × 16 + 14 = 3090→ 9 × 16 + 0 = 144ff→ 15 × 16 + 15 = 255
So the result is rgb(30, 144, 255). The How it was calculated panel repeats this arithmetic with whatever value you enter, so you can check a code by hand or teach the method.
A three-digit code is shorthand: every digit is doubled first. #0af means #00aaff, which gives rgb(0, 170, 255). Shorthand can only express 4,096 colors, so a code like #1e90ff has no short form.
Mistakes to avoid
- Swapped pairs.
#ff901eis not the same blue; it is orange. If the preview looks wrong, check the digit order before anything else. - Typos that are still valid. The letter O is not the digit 0, and
#1e90fFis fine but#1e90fgis not. The converter flags anything outside 0–9 and a–f. - Expecting print colors. RGB describes light on a screen. For a print estimate, continue to HEX to CMYK.
Need the other direction? Use RGB to HEX, or browse every pair in the Color Conversion Tools.
Frequently asked questions
Why does my design tool show the same color as HEX but my code needs RGB?
They are two spellings of the same 24-bit sRGB value. HEX is compact for tokens and stylesheets; rgb() is easier to read channel by channel and to combine with an alpha value in CSS, such as rgb(30 144 255 / 50%).
Does upper or lower case matter in a HEX code?
No. #1E90FF and #1e90ff are identical. The converter accepts either and always returns whole-number channels from 0 to 255.
What about eight-digit HEX codes with transparency?
This pair page converts opaque colors, so #RRGGBBAA is rejected rather than silently dropping the alpha byte. The general Color Converter keeps transparency.
Is the conversion exact?
Yes. HEX and RGB hold exactly the same information, so HEX to RGB and back always returns the original code. Rounding only appears when you continue to HSV, HSL or CMYK.
Is my color sent anywhere?
No. The conversion, previews and copy buttons all run in your browser.