The most complete free Hex to RGB converter online
Convert HEX↔RGB↔RGBA↔HSL↔HSV↔CMYK both ways with instant, validated results — then pick visually, build palettes, ramps and gradients, check WCAG contrast, simulate colour blindness, extract colours from images and export CSS, SCSS, Tailwind, JSON design tokens, CSV or PDF. Everything runs in your browser, free, with nothing uploaded.
Bidirectional conversion
HEX↔RGB, RGBA, HSL, HSV and CMYK — edit any field and every other format updates instantly, both ways.
Advanced colour picker
Saturation/brightness square, hue & opacity sliders, native picker and screen eyedropper — all synced in real time.
Multi-format output
See HEX, RGB, RGBA, HSL, HSV, CMYK, LAB, CSS variable and the nearest Tailwind token together for one colour.
WCAG accessibility
Check any foreground/background pair against AA and AAA thresholds with a live contrast ratio and pass/fail badges.
Colour-blindness preview
See your colour under protanopia, deuteranopia, tritanopia and achromatopsia before you ship it.
Palettes & harmonies
Generate complementary, analogous, triadic, tetradic and monochromatic palettes plus a Tailwind 50–950 scale.
Tints, shades, tones & gradients
Build 5/10/20-step ramps and linear, radial or conic CSS gradients with copy-ready code.
Image & logo extraction
Upload a PNG, JPG, WEBP or SVG and pull out the dominant colour, brand colours and a full palette — on-device.
Developer exports
Export CSS, SCSS, LESS, Tailwind, JSON design tokens, CSV, SVG and PDF for design systems and component libraries.
Bulk converter
Paste hundreds of colours at once and convert them all to every format, then export the table.
History & favourites
Every colour is auto-saved to an offline IndexedDB history; star colours and organise them into collections.
Keyboard-first
Convert, copy, save and reset from the keyboard, with a built-in shortcut reference.
How to convert HEX to RGB
Enter a colour
Type or paste a HEX value (#FF5733, FF5733, #FFF or FFF), an rgb()/hsl() string, or pick visually. Shorthand and bare hex are auto-expanded and validated.
Read every format
The output panel instantly shows RGB(255, 87, 51) plus RGBA, HSL, HSV, CMYK, the CSS variable and the closest Tailwind colour.
Copy or tweak
One-click copy any format, fine-tune with the picker and sliders, or edit a different field to convert in the opposite direction.
Generate & export
Build palettes, ramps and gradients, check contrast, then export CSS, SCSS, Tailwind, JSON tokens, CSV or PDF — or save the colour to favourites.
What is HEX to RGB conversion?
HEX to RGB conversion is the process of translating a hexadecimal colour code — the familiar six-character strings like #FF5733 you see throughout CSS, design tools and brand guidelines — into the equivalent RGB triplet, written rgb(255, 87, 51). Both notations describe exactly the same colour in the same sRGB colour space; they are simply two ways of writing the same three numbers. A HEX code packs the red, green and blue channels into base-16 digits, while RGB writes them out in plain base-10 from 0 to 255. Converting between them is lossless and perfectly reversible, which is why a good Hex to RGB converter also works as an RGB to Hex converter without any change in the underlying value.
To understand the conversion you only need to understand the structure of a HEX code. After the leading hash, the six characters are three pairs: the first pair is red, the second is green, and the third is blue. Each pair is a two-digit hexadecimal number ranging from 00 to FF, which in decimal is 0 to 255. So in #FF5733, the red pair FF equals 255, the green pair 57 equals 87, and the blue pair 33 equals 51 — giving rgb(255, 87, 51). The maths for each pair is straightforward: the first hex digit is multiplied by 16 and the second is added. For the green channel 57, that is 5 × 16 + 7 = 87. Reverse the process to go from RGB back to HEX: divide-and-modulo each channel by 16, or simply format each 0–255 number as a two-digit, zero-padded hexadecimal string and concatenate the three pairs.
Shorthand HEX is a common shortcut you will meet constantly. A three-character code such as #FFF or #0AF is expanded by doubling each digit, so #FFF becomes #FFFFFF (pure white) and #0AF becomes #00AAFF. Four- and eight-character HEX codes add an alpha (opacity) channel: #RGBA and #RRGGBBAA, where the final pair encodes transparency from 00 (fully transparent) to FF (fully opaque). When alpha is present, the natural RGB output is RGBA — for example rgba(255, 87, 51, 0.5) for a half-transparent version. This converter accepts all of these forms — with or without the hash, upper or lower case, shorthand or full, with or without alpha — and normalises them automatically, so you can paste whatever you have to hand and get a clean, correct result.
Why does this conversion matter so much in practice? Because different tools and contexts prefer different notations. HEX is compact and is the de-facto standard in CSS, design handoffs, brand books and most graphics applications. RGB is more readable for humans reasoning about individual channels and is the form many programming languages, image libraries, game engines, micro-controllers (think addressable LED strips) and data-visualisation toolkits expect. Designers frequently receive a HEX value from a brand palette and need RGB to plug into a tool that only takes numeric channels; developers often have RGB values from a script and need HEX for a stylesheet. Converting by hand is error-prone — a single transposed digit produces a visibly wrong colour — so an instant, validated converter removes a small but constant source of friction and bugs.
It is worth being clear about what HEX and RGB do and do not capture. Both are device-dependent descriptions within the sRGB colour space, the standard gamut of the web and most monitors. They tell a screen how much red, green and blue light to emit, but they say nothing about how that colour will look on paper, where ink behaves subtractively rather than additively. That is why this tool also converts to CMYK (the cyan-magenta-yellow-black model used in printing) and to perceptual spaces like HSL, HSV and LAB that are far easier to reason about when you want to lighten, mute or find a harmonious match for a colour. The HEX↔RGB pair is the hub of all of this: once you have the RGB channels, every other colour model is one well-defined formula away, which is exactly how this platform produces a complete, multi-format readout from a single input.
Finally, accuracy and privacy. HEX, RGB, RGBA, HSL and HSV conversions are exact and round-trip perfectly; LAB and XYZ use the standard sRGB/D65 matrices and are accurate to display precision; CMYK is a profile-free approximation that should be treated as a starting point and proofed on the target press. Every calculation here runs entirely in your browser using plain JavaScript — your colours, palettes and any images you analyse never touch a server. That makes the tool fast (results appear as you type, with no network round-trip), private by design, and fully functional offline once the page has loaded.
Understanding HEX colours
A HEX colour code is a hexadecimal (base-16) representation of an RGB colour. Hexadecimal uses sixteen symbols — 0–9 then A–F — so a single hex digit represents 0 to 15, and a pair of digits represents 0 to 255, exactly the range of one colour channel. This neat alignment is why HEX became the web’s favourite shorthand: two compact characters express a full 8-bit channel, and six characters express a complete 24-bit colour with over 16.7 million possibilities.
The format is #RRGGBB. The hash signals a colour literal; the three pairs are red, green and blue in that fixed order. #000000 is black (no light), #FFFFFF is white (full light), #FF0000 is pure red, #00FF00 pure green and #0000FF pure blue. Mixing the channels produces every other colour: #FFFF00 (red + green) is yellow, #FF00FF is magenta, #808080 is mid-grey. Because the pairs are independent, you can read a HEX code at a glance once you are fluent — a high first pair and low others means a reddish colour, equal pairs mean a neutral grey.
Modern CSS extends HEX with alpha. An eight-digit code #RRGGBBAA appends an opacity pair, and the four-digit #RGBA is its shorthand. So #FF573380 is the same orange-red as #FF5733 but at roughly 50% opacity. HEX is case-insensitive (#ff5733 equals #FF5733) and the leading hash is optional in many tools, which is why robust converters accept bare, shorthand and alpha variants alike rather than rejecting anything that is not a perfect six-digit string.
Understanding RGB colours
RGB stands for Red, Green, Blue — the three primary colours of light. It is an additive colour model: you start from black (no light) and add red, green and blue light to build every other colour, reaching white when all three are at full intensity. This is precisely how screens work, where each pixel is a trio of tiny red, green and blue emitters, so RGB maps directly onto the hardware that displays your work.
In CSS and most software, each channel is an integer from 0 to 255 (8 bits), written rgb(255, 87, 51). Some contexts use percentages — rgb(100%, 34%, 20%) — or floating-point 0–1 values common in shaders and graphics APIs; they all describe the same thing at different scales. RGBA adds a fourth value, alpha, expressing opacity from 0 (transparent) to 1 (opaque): rgba(255, 87, 51, 0.5). Alpha is not part of the colour itself but controls how the colour composites over whatever is behind it.
RGB’s strength is its directness and exactness; its weakness is that it is unintuitive to edit. Making a colour “a bit lighter” or “less intense” by nudging three correlated numbers is hard, because lightness and saturation are spread across all three channels. That is why designers reach for HSL or HSV when adjusting colours, and why this converter shows those models alongside RGB — you can pick and reason in HSL, then read off the exact RGB and HEX the rest of your stack needs.
HEX vs RGB explained
HEX and RGB are not competing colour models — they are two encodings of the same sRGB colour. Choosing between them is about ergonomics and context, not accuracy. HEX is shorter, copy-paste friendly and the convention in CSS, design tools and brand documentation; a single token like #10B981 is easy to share and store. RGB is more legible when you care about the individual channels, and it is the form most programming languages, image-processing libraries and hardware expect.
There are practical differences worth knowing. RGB makes per-channel manipulation explicit — useful when an algorithm needs to tweak only the red channel, for instance. RGB also expresses alpha and percentages naturally, while classic six-digit HEX cannot carry opacity (you need the eight-digit form). HEX, on the other hand, is unambiguous and compact, with no spaces or commas to mishandle in a config file. Neither is “more accurate”; converting back and forth never changes the colour.
In a typical workflow you will use both: store brand colours as HEX, hand them to developers who convert to RGB or RGBA for runtime tinting and compositing, and convert back to HEX for the final stylesheet. The friction is purely in the translation, which is exactly what this bidirectional converter removes — paste either, get both (plus HSL, HSV, CMYK and more), and copy whichever your current tool wants.
How web browsers handle colours
When a browser encounters a colour — whether you wrote it as #FF5733, rgb(255, 87, 51), hsl(11, 100%, 60%) or the keyword tomato — it parses the value into an internal RGB(A) representation, almost always in the sRGB colour space. From the browser’s point of view these notations are interchangeable inputs that resolve to the same pixels, which is why you can mix them freely across a stylesheet.
CSS has steadily expanded what counts as a valid colour. Alongside HEX, rgb(), hsl() and 147 named keywords, modern browsers support hwb(), lab(), lch(), oklab(), oklch() and the color() function for wide-gamut spaces like Display P3. The newer perceptual functions (especially OKLCH) produce more even lightness and more stable hues, which is why they are increasingly recommended for generating accessible scales and smooth gradients. This converter surfaces these modern values so you can adopt them confidently.
Two browser behaviours are worth remembering. First, colours are resolved at computed-value time, so a colour declared in one notation may be reported by the DevTools or the CSSOM in another — typically rgb() or oklab(). Second, gamut matters: a vivid colour authored in a wide-gamut space may be clipped to sRGB on a standard display. For the vast majority of web work, sRGB HEX and RGB remain the safe, universally supported default — which is what this tool defaults to.
Colour conversion for developers
For developers, colour conversion is a routine but error-prone chore that shows up everywhere: turning a design’s HEX tokens into RGBA for runtime opacity, feeding numeric channels to a canvas or WebGL shader, theming a charting library, driving RGB LED hardware, or generating a consistent palette in code. Getting a digit wrong is silent — the build still passes, the colour is just visibly off — so a fast, validated converter is a genuine productivity and correctness aid.
This platform is built developer-first. Beyond instant HEX↔RGB↔HSL↔HSV↔CMYK conversion, it exports ready-to-paste CSS custom properties, SCSS and LESS variables, a Tailwind theme.extend.colors block, JSON design tokens (Style Dictionary / Figma friendly), CSV and SVG. The bulk converter turns a pasted list of colours into a full table in one pass, and a stateless, CORS-enabled JSON API (/api/color-convert) lets you script conversions or wire them into build steps and CI — with a clear path to higher-volume, authenticated tiers as needs grow.
Under the hood the conversions use the standard sRGB/D65 formulas with no external dependencies, so the results match what your language’s colour libraries and the browser itself produce. Round-tripping HEX→RGB→HEX is guaranteed identical, which matters when you are snapshotting design tokens or asserting colours in tests. And because everything runs client-side, you can use the tool on internal or sensitive palettes without anything leaving your machine.
Colour conversion for designers
Designers move between colour models constantly: a brand book specifies HEX, a print vendor needs CMYK, a UI kit wants RGB or HSL, and a presentation tool offers only a colour wheel. A converter that shows every format at once — and lets you pick visually — keeps you in flow instead of juggling separate utilities. Enter a single brand colour and read off HEX for the website, RGB for the app, CMYK for the brochure and HSL for quick, intuitive adjustments.
The platform also supports the creative side of colour work. Harmony generators build complementary, analogous, triadic, split-complementary, tetradic, square and monochromatic palettes from any base colour using colour-wheel relationships. Tint, shade and tone ramps (in 5, 10 or 20 steps) and a Tailwind-style 50–950 scale give you the tonal range a design system needs. The gradient builder produces linear, radial and conic gradients with adjustable stops and angles, and image extraction pulls a palette straight from a photo, screenshot or logo so you can match an existing visual.
Crucially, good colour is accessible colour. The contrast checker measures any text/background pair against WCAG AA and AAA, and the colour-blindness simulator shows how a palette reads to viewers with the common colour-vision deficiencies. Designing with these in view from the start — rather than retrofitting accessibility later — produces interfaces that look intentional and work for everyone, and the tool makes that check a one-click habit.
Accessibility and colour contrast
Colour contrast is the single most impactful accessibility factor in visual design. The Web Content Accessibility Guidelines (WCAG) define a contrast ratio between text and its background that ranges from 1:1 (identical) to 21:1 (black on white). At level AA, normal body text needs at least 4.5:1 and large text (≥24px, or ≥18.66px bold) needs 3:1; user-interface components and meaningful graphics also need 3:1. The stricter AAA level asks for 7:1 for normal text and 4.5:1 for large text.
The ratio is computed from each colour’s relative luminance — a perceptually weighted measure (0.2126·R + 0.7152·G + 0.0722·B on linearised channels) that reflects the eye’s greater sensitivity to green. The formula is (L_lighter + 0.05) / (L_darker + 0.05). Because luminance depends mostly on lightness rather than hue, the practical lesson is that to fix failing contrast you usually need to change how light or dark a colour is, not just its hue — two colours can share a hue and still pass or fail depending on lightness.
This tool’s contrast checker reports the exact ratio for any foreground/background pair, flags which AA and AAA thresholds pass or fail, and suggests whether black or white text is more legible on a given colour. Pair it with the colour-blindness simulator and you can verify that meaning never depends on colour alone — adding labels, icons, patterns or lightness differences where two colours might otherwise be confused. Accessible-by-default colour choices are easier to build in from the start than to retrofit, and they widen your audience at no cost to aesthetics.
CSS colour best practices
Treat colour as a system, not a set of one-off values. Define your palette once as CSS custom properties (or design tokens) — a primary with a full 50–950 scale, one or two accents, a neutral grey ramp, and semantic colours for success, warning, error and info — then reference those variables everywhere. Rebranding or building dark mode then becomes a change in one place rather than a find-and-replace across the codebase, and this tool exports exactly those token sets for you.
Choose notations deliberately. HEX is perfect for static, opaque brand colours; use rgb()/rgba() or the eight-digit HEX when you need opacity; and prefer HSL or OKLCH when you generate variations in code, because adjusting lightness or chroma is meaningful in those spaces. For perceptually even scales and smooth gradients, OKLCH is now the best-practice choice in modern browsers, with a HEX/RGB fallback for older ones.
Finally, bake accessibility and consistency into the workflow. Verify every text/background pairing against WCAG before shipping, avoid conveying information by hue alone, do not use pure black (#000) on pure white for large text areas (slightly softened neutrals reduce eye strain), and keep your token names semantic (color-primary-600) rather than literal (color-emerald) so the system survives a rebrand. Export your finalised palette as CSS variables, SCSS, Tailwind config or JSON tokens to keep design and code in lockstep.
HEX vs RGB at a glance
| HEX | RGB | |
|---|---|---|
| Notation | #FF5733 (base-16) | rgb(255, 87, 51) (base-10) |
| Length | 6–8 characters, compact | Longer, comma-separated |
| Readability | Quick to copy/share | Easier per-channel reasoning |
| Alpha / opacity | Only via 8-digit #RRGGBBAA | Native via rgba() |
| Best for | CSS, design tools, brand books | Code, image libs, hardware, shaders |
| Colour space | sRGB | sRGB (identical colour) |
RGB (screen) vs CMYK (print)
| RGB | CMYK | |
|---|---|---|
| Model | Additive (light) | Subtractive (ink) |
| Used by | Screens, web, apps | Printers, press |
| Channels | Red, Green, Blue (0–255) | Cyan, Magenta, Yellow, Key (0–100%) |
| Gamut | Wider on screen | Narrower; vivid colours dull |
| Accuracy | Exact | Approximate without ICC profile |
Who uses a Hex to RGB converter?
Front-end developers
Turn design HEX tokens into RGBA for opacity, theme components, and export CSS variables or Tailwind config.
UI / UX designers
Read every format at once, build harmonised palettes and ramps, and check contrast before handoff.
Print & branding
Convert screen RGB/HEX brand colours to CMYK approximations for brochures, packaging and signage.
Game & graphics devs
Get 0–255 or 0–1 RGB channels for shaders, canvas, engines and data-visualisation libraries.
Hardware & IoT
Drive RGB LEDs, displays and micro-controllers with exact numeric channels from any HEX value.
Students & educators
See the maths behind HEX↔RGB, explore colour models, and learn accessible colour with live examples.