Convert any hex color code to RGB values instantly
Paste a hex color code and get the exact RGB values in one click — no math, no guessing. The tool also shows you the color in HSL, HSV, and CMYK, along with a live color swatch so you can confirm it looks right.
How to convert hex to RGB
- Type or paste your hex code into the input field above (with or without the
#symbol). - The RGB values appear immediately — no button needed.
- Click the copy icon next to any value to grab it for your code or design tool.
- The live swatch updates as you type, so you can spot-check the color at a glance.
Worked example: converting a hex code to RGB
Say your designer hands you the hex code #1A73E8 — Google's signature blue. Here is what the converter gives you:
| Format | Value |
|---|---|
| Hex | #1A73E8 |
| RGB | rgb(26, 115, 232) |
| HSL | hsl(217, 80%, 51%) |
| HSV | hsv(217, 89%, 91%) |
| CMYK | cmyk(89%, 50%, 0%, 9%) |
The three RGB numbers represent Red (26), Green (115), and Blue (232) — each on a scale of 0 to 255. A higher number means more of that color channel. So this blue has very little red, some green, and a lot of blue.
How to do this in code
If you need to convert hex to RGB inside your own project, here are minimal, copy-pasteable snippets:
JavaScript
function hexToRgb(hex) {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
console.log(hexToRgb('#1A73E8'));
// { r: 26, g: 115, b: 232 }
Python
def hex_to_rgb(hex_color):
hex_color = hex_color.lstrip('#')
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
print(hex_to_rgb('#1A73E8'))
# (26, 115, 232)
Both snippets split the hex string into three two-character pairs (one for each channel) and convert each from base-16 to a regular 0–255 integer.
How it works
A hex color code like #1A73E8 is just three pairs of hexadecimal (base-16) digits written back to back: 1A = red, 73 = green, E8 = blue. The converter parses each pair and translates it into a decimal (base-10) number from 0 to 255 — the standard range for an RGB channel.
The conversion is pure arithmetic and happens entirely in your browser. Nothing you type is sent to a server, so your colors stay completely private.
The W3C CSS Color Level 4 specification defines how browsers interpret hex codes and RGB values — this tool follows that same standard.
When to use hex vs. RGB
- Use hex in HTML, CSS, and design tools like Figma or Sketch — it's compact and widely supported.
- Use RGB when you need to manipulate individual color channels in code, apply CSS functions like
rgba()for transparency, or pass color data to a canvas or WebGL API. - Use HSL if you want to programmatically lighten or darken a color — it's much easier to reason about than either hex or RGB.
When this tool won't help
- 4-digit and 8-digit hex codes (which include an alpha/transparency channel) — use the
rgba()format instead and note that the alpha channel is a separate value from 0 to 1. - CSS named colors like
cornflowerblue— look those up in the MDN named color reference to get their hex equivalents first. - Pantone or RAL print colors — those don't map to screen RGB in a standardized way.
Quick snippet bait: #FF4500 in RGB
The hex code #FF4500 (OrangeRed) converts to rgb(255, 69, 0). That means maximum red (255), a little green (69), and no blue at all (0) — which is exactly why it looks like a vivid flame orange on screen.
No sign-up, no ads, no upload — just paste your hex code above and your RGB values are ready to copy.