Color Code Converter — HEX to RGB, HSL & CMYK

A color code converter that turns any HEX color into RGB, HSL and CMYK — with a live preview. Type a hex code or tap a swatch. Free, no sign-up.

Preview

HEX —
RGB —
HSL —
CMYK —

Live previewOne-click copyHEX · RGB · HSL · CMYKNo sign-up

What Is a Color Code Converter?

A color code converter translates one color notation into another. For example, the hex code #FF5733 is the RGB color rgb(255, 87, 51) — also written hsl(11, 100%, 60%) or cmyk(0%, 66%, 80%, 0%). Web developers and designers use it to move values between CSS, JavaScript, design tools and documentation without doing base-16 arithmetic by hand. The converter above is free, instant and runs entirely in your browser — type a HEX code and copy the RGB, HSL or CMYK result in one click.

What Is a HEX Color Code?

A HEX color code is a six-digit hexadecimal number where each pair of digits sets the intensity of red, green and blue light from 00 (off) to FF (full). #FF0000 is pure red, #00FF00 pure green, #0000FF pure blue — and #FFFFFF is white.

#FF5733 → RGB: FF=255, 57=87, 33=51 → rgb(255, 87, 51) — a vivid orange-red.

How Do You Convert Hex to RGB by Hand?

Split the six hex digits into three pairs and convert each pair from base-16 (hexadecimal) to decimal. Each pair is one byte — an 8-bit value where 0016 = 0 and FF16 = 255 — setting the intensity of red, green and blue light. To convert one pair, multiply the first digit by 16 and add the second digit (digits A–F are worth 10–15). Then write the three results as rgb(R, G, B).

Worked example — #FF5733 → RGB:
Red: FF₁₆ = 15 × 16 + 15 = 255
Green: 57₁₆ = 5 × 16 + 7 = 87
Blue: 33₁₆ = 3 × 16 + 3 = 51
→ rgb(255, 87, 51) — a vivid orange-red.

Two more to check your method: #33CCFF → 3316 = 51, CC16 = 12 × 16 + 12 = 204, FF16 = 255 → rgb(51, 204, 255); #800080 → 8016 = 8 × 16 = 128 → rgb(128, 0, 128) (purple).

How Do You Convert RGB Back to Hex?

Divide each 0–255 channel value by 16; the quotient and remainder become the two hex digits (10 → A, 11 → B, 12 → C, 13 → D, 14 → E, 15 → F). Join the three pairs and add the # prefix.

Worked example — (255, 215, 0) → HEX:
Red: 255 ÷ 16 = 15 remainder 15 → FF
Green: 215 ÷ 16 = 13 remainder 7 → D7
Blue: 0 → 00
→ #FFD700 — gold.

HEX, RGB, HSL, HSV and CMYK: When to Use Each

All five notations can describe the same color — they differ in how humans and machines read them.

Format Stands for Example Best for
HEX Hexadecimal RRGGBB #FF5733 CSS stylesheets, HTML, design handoffs
RGB Red, Green, Blue (0–255) rgb(255, 87, 51) JavaScript, canvas, graphics APIs
HSL Hue (0–360°), Saturation, Lightness hsl(11, 100%, 60%) Picking tints and shades intuitively
HSV Hue, Saturation, Value / brightness hsv(11, 80%, 100%) Color pickers in design software
CMYK Cyan, Magenta, Yellow, Key/black (%) cmyk(0%, 66%, 80%, 0%) Print design

Rule of thumb: use HEX in CSS, RGB in code, HSL when you need to tweak brightness or build a palette (fix the hue, slide lightness up for tints and down for shades), and CMYK only when the output is a printer. HSV appears mainly inside color-picker interfaces — convert it to HEX before shipping.

Understanding Alpha: 8-Digit Hex and rgba()

Transparency adds a fourth channel — alpha — to any color. In 8-digit hex (#RRGGBBAA), the last pair sets opacity from 00 (fully transparent) to FF (fully opaque). #FF573380 is red at about 50% opacity: 8016 = 128, and 128 ÷ 255 ≈ 0.50.

CSS gives you three equivalent ways to write the same semi-transparent red:

#FF573380 — 8-digit hex (CSS Color 4, supported in all modern browsers)
rgba(255, 87, 51, 0.5) — classic function syntax
rgb(255 87 51 / 50%) — modern space-separated syntax

Alpha is essential for overlays, gradients and hover states — and it matters for the contrast math below, because text over a translucent background blends with whatever sits behind it.

Common Color Codes: Reference Table

A quick-lookup chart of widely used colors, with swatch, HEX, RGB and HSL for each. Every value below can be double-checked in the converter above — just type the HEX code.

Color HEX RGB HSL
Black #000000 (0, 0, 0) (0°, 0%, 0%)
White #FFFFFF (255, 255, 255) (0°, 0%, 100%)
Red #FF0000 (255, 0, 0) (0°, 100%, 50%)
Lime #00FF00 (0, 255, 0) (120°, 100%, 50%)
Blue #0000FF (0, 0, 255) (240°, 100%, 50%)
Yellow #FFFF00 (255, 255, 0) (60°, 100%, 50%)
Cyan / Aqua #00FFFF (0, 255, 255) (180°, 100%, 50%)
Magenta / Fuchsia #FF00FF (255, 0, 255) (300°, 100%, 50%)
Silver #C0C0C0 (192, 192, 192) (0°, 0%, 75%)
Gray #808080 (128, 128, 128) (0°, 0%, 50%)
Maroon #800000 (128, 0, 0) (0°, 100%, 25%)
Olive #808000 (128, 128, 0) (60°, 100%, 25%)
Green #008000 (0, 128, 0) (120°, 100%, 25%)
Purple #800080 (128, 0, 128) (300°, 100%, 25%)
Teal #008080 (0, 128, 128) (180°, 100%, 25%)
Navy #000080 (0, 0, 128) (240°, 100%, 25%)
Orange #FFA500 (255, 165, 0) (39°, 100%, 50%)
Gold #FFD700 (255, 215, 0) (51°, 100%, 50%)
Coral #FF7F50 (255, 127, 80) (16°, 100%, 66%)
Tomato #FF6347 (255, 99, 71) (9°, 100%, 64%)
Pink #FFC0CB (255, 192, 203) (350°, 100%, 88%)
Brown #A52A2A (165, 42, 42) (0°, 59%, 41%)
Beige #F5F5DC (245, 245, 220) (60°, 56%, 91%)
Turquoise #40E0D0 (64, 224, 208) (174°, 72%, 56%)
Indigo #4B0082 (75, 0, 130) (275°, 100%, 25%)
Violet #EE82EE (238, 130, 238) (300°, 76%, 72%)

CSS Snippets for Developers

Once you have the values, drop them straight into your stylesheet. These four all describe the same orange-red:

color: #FF5733;
background-color: rgb(255, 87, 51);
border-color: hsl(11, 100%, 60%);
box-shadow: 0 4px 12px #FF573380; — shadow at 50% opacity

Contrast and Readability: The WCAG Rule

A color is only the right choice if people can read on it. The W3C’s WCAG 2.1 guidelines require a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (Level AA); Level AAA raises normal text to 7:1. As a quick check: dark text on white, or white text on very dark backgrounds, almost always passes. Mid-tone colors like #FF5733 or #808080 often fail with white text — darken or lighten the background until the ratio clears 4.5:1.

Why Print Colors Look Different From Screen Colors

Screens emit light (additive RGB); printers lay ink on paper (subtractive CMYK). Ink cannot reproduce the brightest, most saturated screen colors — its gamut is smaller — so neon greens, electric blues and vivid oranges shift or dull in print. The converter’s CMYK values are the standard naive conversion from RGB (K = 1 − max(R′, G′, B′), then each of C, M and Y scaled by 1 − K); professional print work should go through a proper ICC color profile instead. Always request a physical proof before a large print run.

A Note on Modern Formats: OKLCH and Display-P3

CSS Color 4 added perceptually uniform spaces like OKLCH — where equal numeric steps look equally different to the eye, fixing HSL’s uneven gradients — and wide-gamut Display-P3, which covers the richer colors that modern phone and laptop screens can display. HEX, RGB and HSL remain the everyday standards and convert losslessly among themselves; the new formats matter when you need smoother gradients or the most vivid screen colors possible.

How to Use the Color Converter

  1. Type a HEX code (with or without #, 3 or 6 digits) — RGB, HSL and CMYK appear instantly with a live preview.
  2. Or tap any quick-pick swatch to load a common color.
  3. Use the Copy buttons to grab any value for your CSS or design tool.

Color Code FAQs

How do you convert hex to RGB?
Split the six hex digits into three pairs and convert each pair from base-16 to decimal. #FF5733 → FF = 255, 57 = 87, 33 = 51 → rgb(255, 87, 51). The converter above does it instantly.
What is #FF5733 in RGB?
#FF5733 is rgb(255, 87, 51) — a vivid orange-red. The pair math: FF₁₆ = 15 × 16 + 15 = 255 (red), 57₁₆ = 5 × 16 + 7 = 87 (green), 33₁₆ = 3 × 16 + 3 = 51 (blue).
How do I convert RGB back to hex?
Divide each 0–255 channel value by 16; the quotient and remainder become the two hex digits (10 → A, 11 → B, 12 → C, 13 → D, 14 → E, 15 → F). For (255, 215, 0): 255 ÷ 16 = 15 remainder 15 → FF; 215 ÷ 16 = 13 remainder 7 → D7; 0 → 00 → #FFD700 (gold).
What is the difference between HEX and RGB?
Nothing in what they describe — HEX and RGB are two notations for the same color. #FF0000 and rgb(255, 0, 0) are both pure red: HEX writes the three 0–255 channel values in base 16, while RGB writes them in decimal.
What is the difference between 3-digit and 6-digit HEX?
3-digit HEX is shorthand: each digit is doubled. #F53 expands to #FF5533 and #F60 expands to #FF6600. Both describe the same color.
What does the # mean in a color code?
The # is just a prefix marking the number as hexadecimal — a convention from HTML and CSS. FF5733 and #FF5733 mean the same color; this tool accepts both.
How do HSL and HSV differ from RGB?
RGB describes a color as red, green and blue light mixed together; HSL and HSV describe the same color as a hue angle (0–360°), saturation and lightness/value. They convert losslessly into each other — #FF5733 is rgb(255, 87, 51), hsl(11, 100%, 60%) and hsv(11, 80%, 100%) — but HSL is more intuitive for picking tints and shades.
What is CMYK, and when should I use it instead of RGB?
CMYK (cyan, magenta, yellow, key/black) is the ink-based model for print, written as four percentages. Use RGB for anything on a screen and CMYK when sending work to a printer. This converter’s CMYK values are the standard naive conversion from RGB; professional print work should use a proper ICC color profile.
How many colors can HEX or RGB represent?
16,777,216. Each of the three channels holds one byte — 0 to 255, or 00 to FF — so 256 × 256 × 256 = 16,777,216 possible colors.
How do I add transparency to a hex color?
Use 8-digit hex (#RRGGBBAA): the last pair is the alpha channel, from 00 (transparent) to FF (opaque). #FF573380 is red at about 50% opacity — 80₁₆ = 128, and 128 ÷ 255 ≈ 0.50. In CSS you can also write rgba(255, 87, 51, 0.5) or rgb(255 87 51 / 50%).
Why do print colors look different from screen colors?
Screens emit RGB light; printers mix CMYK inks on paper, which reproduces a smaller range of colors (gamut). Bright neons and saturated oranges shift the most. Always proof critical print work.
Is this color converter free?
Yes — free, unlimited, no sign-up. All conversions run in your browser.