🔒 100% private — runs in your browser, nothing is uploaded

Color Converter (HEX ↔ RGB)

Convert HEX to RGB and back, with live preview.

HEX (#4f46e5) and RGB (79, 70, 229) are two notations for the same color — HEX is compact for CSS, RGB is explicit for design tools.


All formats + closest named color

The converter above switches between HEX and RGB. Enter a HEX value here to get every common format at once, plus the closest of the 16 basic CSS color names (matched by red-green-blue distance).

Read the guide: Hex, RGB, HSL — and the Contrast Ratio Your Text Needs

How to use

  1. Type a HEX code or RGB values — the other updates live.
  2. See the color preview instantly.
  3. Click "Random color" for inspiration, "Copy HEX" to grab it.

About this tool

Designers constantly convert between them when moving colors from mockups to code.

Conversion happens instantly in your browser.

HSL and HSV describe the same hue two different ways: HSL lightness peaks at the midpoint between black and white, while HSV value simply measures the brightest channel. CMYK answers a different question entirely — how much cyan, magenta, yellow and black ink a printer lays down. The named-color match is a nearest-neighbour lookup, not an official naming: it tells you which of the sixteen original CSS keywords your color is closest to, which is handy for quick mock-ups and for describing a swatch in plain words.

How it works

In #RRGGBB, each pair of hex digits is one color channel: #FF5733 means red = FF (255), green = 57 (87), blue = 33 (51). Converting HEX to RGB is just base-16 to base-10, done three times — and back again is base-10 to base-16, padded to two digits.

HSL is a third view built for humans: hue (0–360°, position on the color wheel), saturation (0–100%, gray to vivid), lightness (0–100%, black to white). Designers reach for HSL because 'make it a little darker' is simply lowering the lightness number, while in RGB the same tweak means recalculating all three channels.

The numbers are exact — #FF5733 is always rgb(255, 87, 51) on every screen — but the live preview still helps, because the same values render slightly differently across displays.

Worked examples

From design tool to CSS: Figma hands you #3B82F6. Convert it to rgb(59, 130, 246) for a box-shadow, or to hsl(217, 91%, 60%) when you want hover states — just raise the lightness for a lighter variant.

Checking text contrast: White text (#FFFFFF) on a #FF5733 button: convert both to RGB, compute relative luminance, and you can verify the WCAG contrast ratio before the design ships.

Quick reference

FormatExampleBest for
HEX#FF5733CSS values, design tools
RGBrgb(255, 87, 51)CSS functions, canvas code
HSLhsl(11, 100%, 60%)Tweaking lightness and saturation

Frequently asked questions

What is the difference between HEX and RGB?

None in meaning — #FF0000 and rgb(255,0,0) are the same red. HEX is shorter; RGB is more readable.

Why do I see 3 or 6 digit HEX codes?

#F00 is shorthand for #FF0000 — each digit is doubled. This tool uses the full 6-digit form.

Is anything uploaded?

No — everything runs locally.

What are the formats for pure red, #FF0000?

RGB rgb(255, 0, 0), HSL hsl(0, 100%, 50%), HSV hsv(0, 100%, 100%) and CMYK cmyk(0%, 100%, 100%, 0%). Its closest basic CSS color name is red, an exact match.

How is the closest named color chosen?

The 16 basic CSS color names (black, silver, gray, white, maroon, red, purple, fuchsia, green, lime, olive, yellow, navy, blue, teal, aqua) are compared with your color by straight-line distance in RGB space, and the smallest distance wins. Note that CSS 'green' is the dark #008000 — the bright #00FF00 is 'lime'.

Why does CMYK matter if my work is on screen?

CMYK is the print color model. Converting before you send a design to print shows how much ink each channel needs and warns you early that very bright screen colors (which CMYK cannot reproduce) will dull on paper.

📦 Embed this tool on your site

<iframe src="https://verystep.com/embed/color/" title="Color Converter (HEX ↔ RGB)" width="100%" height="520" loading="lazy" style="border:0"></iframe>

Free to use. The embed shows a small "Powered by Verystep" link.

First time embedding? Read the step-by-step guide →

More free tools