Color Converter
Nearest CSS name
HEX:
HEX
Compact form for code.
RGB
What screens and canvas expect.
RGBA
RGB with an alpha of 1 (solid).
HSL
The form humans adjust.
HSLA
HSL with an alpha of 1 (solid).
HSV
Hue, saturation, and value (brightness).
CMYK — approximate
Approximate — proof before printing.
OKLCH (live)
Computed live by the tool.
CSS variable
One change updates the whole site.
Share this page
Convert any color free. Enter HEX, RGB, HSL, HSV, CMYK, or OKLCH once and get every format at once, all in sync, with copy buttons and CSS variables included.
One color, every format, all in sync
One color entered here comes out in every format at once: HEX, RGB, RGBA, HSL, HSLA, HSV, CMYK, OKLCH, and a CSS variable. Type #3B82F6 and the page answers rgb(59, 130, 246), hsl(217, 91%, 60%), hsv(217, 76%, 96%), and cmyk(76%, 47%, 0%, 4%) together, with a copy button on each line. Edit any one field and all the others follow it instantly.
That is the whole job of this page: it is the reverse-direction hub for the site. A designer who has an HSL value and needs HEX, a developer who has CMYK and needs RGB, and a student checking homework all use this one page instead of hunting through separate converters.
At a glance — your color in four formats
- HEX
- RGB
- HSL
- CMYK (approx.)
The full sync board — all nine formats — is the tool at the top of this page.
No separate reverse pages — this converter covers them
There are no separate HSL-to-RGB, HSV-to-HEX, CMYK-to-HEX, or OKLCH-to-HEX pages on this site, because this converter already does all of them. Every field here is an input as well as an output, so typing an HSL value gives you the HEX code, typing a CMYK value gives you the RGB numbers, and typing an OKLCH value gives you everything else. Splitting those into separate pages would duplicate this page four times.
One intent still means one page: the intent here is “convert this color into whatever form I need,” whatever form the visitor starts from. The single-format pages (HEX to CMYK, RGB to HSL, and HEX to OKLCH) exist for visitors who want one conversion explained in depth, with the worked math and the caveats.
Reverse-direction demo — tap an arrow to load a sample
Each sample loads into the converter above — watch the whole board update.
Worked example: #3B82F6 in every format
#3B82F6 is rgb(59, 130, 246), hsl(217, 91%, 60%), hsv(217, 76%, 96%), and cmyk(76%, 47%, 0%, 4%) — one color, four notations. The HEX pairs are 3B = 59, 82 = 130, and F6 = 246, which is the RGB triple directly. The HSL hue of 217° puts it in the blue range, and the HSV value of 96% says the brightest channel is nearly at full brightness.
The CMYK figures are approximate, as the HEX to CMYK page explains at length: they are the ink mix that comes closest to this screen color, not an exact match. The OKLCH figures for this color are computed live by the tool and shown on the page, not printed here, because they cannot be verified by hand.
#3B82F6 in every format
| Format | Value | For |
|---|---|---|
| HEX | #3B82F6 | Code |
| RGB | rgb(59, 130, 246) | Screens |
| HSL | hsl(217, 91%, 60%) | Adjusting |
| HSV | hsv(217°, 76%, 96%) | Brightness |
| CMYK | cmyk(76%, 47%, 0%, 4%) | Print (approximate) |
| OKLCH | Even scales (computed live) |
The OKLCH row shows the tool's live value for #3B82F6 — no hand-written OKLCH triple is printed on this page.
Which format should you use?
Use HEX for code, RGB for screens and canvas, HSL for adjusting a color, CMYK for print, and OKLCH for even-looking palettes. HEX is the compact form developers paste into CSS. RGB is what screens and JavaScript canvas code expect. HSL is what humans adjust, because one number changes one visible thing. CMYK is what printers need. OKLCH is what designers use when steps must look even.
The format comparison table on this page lists each form with an example, its ranges, and its best use, so a visitor who only knows one format can pick the right one for the job in front of them. When in doubt, copy the HEX code — it works almost everywhere.
Format chooser — your color, live
| Format | Your color | Ranges | Best use | |
|---|---|---|---|---|
| HEX | #3B82F6 | #RRGGBB | Code | |
| RGB | rgb(59, 130, 246) | 0–255 | Screens | |
| HSL | hsl(217, 91%, 60%) | 0–360°, 0–100% | Adjusting | |
| HSV | hsv(217°, 76%, 96%) | 0–360°, 0–100% | Brightness | |
| CMYK | cmyk(76%, 47%, 0%, 4%) | 0–100% | Print (approximate) | |
| OKLCH | oklch(0.62 0.19 260°) | L 0–1, C 0–0.4 | Even scales |
Tapping a row's Copy button copies that format for your color.
Copying colors into CSS the right way
Copy colors into CSS as a variable, not a bare value, so one change updates the whole site. The export button copies a :root block like --color: #3B82F6; with the visitor's color, ready to paste into a stylesheet. Every use of the color then reads var(--color), and changing the variable changes every button, link, and heading at once.
The page also copies each format on its own for one-off uses: a HEX code for a quick inline style, an rgba() value for a translucent overlay, or an oklch() value for a modern stylesheet. Each copy button confirms with a short “Copied” message so the visitor knows the paste will work.
CSS variable export — your color, live
:root {
--color: #3B82F6;
}Preview: a link in this color
Both are styled with your color — change it in the tool above and they follow.
Rounding and the approximate formats — the honest limits
Two limits apply on this page: rounding can shift one or two RGB channels by 1, and CMYK is always approximate. HSL and HSV are shown in whole degrees and whole percentages, so converting back to RGB can land one or two channels 1 higher or lower — one for HSV, two for HSL on this page's worked example — a shift of less than half a percent, invisible to the eye. HEX stays the source of truth for exact round trips.
CMYK carries the bigger warning, repeated from the HEX to CMYK page: screens add light, printers subtract it with ink, and no formula knows your printer, ink, or paper. The CMYK row on this page carries its own “approximate — proof before printing” label so the warning travels with the number.
The honest limits — beside the results
- Rounding: HSL and HSV are whole numbers, so a round trip can shift one or two RGB channels by 1. Invisible to the eye; keep HEX as the source of truth.
- CMYK is approximate: is the closest ink mix, not an exact match — proof before printing.
- OKLCH is live: is computed by the tool, never hand-written.
All color tools
21 tools, one topic — see About Hex Color Code Picker for who built this site.
- Color Picker from ImageUpload an image, click a pixel, and read its HEX code.
- Screen EyedropperSample any pixel on your screen.
- RGB to HEX ConverterTurn three RGB numbers into one HEX code.
- HEX to RGB ConverterTurn a HEX code into three RGB numbers.
- HEX to HSL ConverterTurn a HEX code into hue, saturation, and lightness.
- HSL to HEX ConverterTurn HSL values back into a HEX code.
- HEX to HSV ConverterTurn a HEX code into hue, saturation, and value.
- HEX to CMYK ConverterTurn a HEX code into approximate print values.
- RGB to HSL ConverterTurn RGB numbers into hue, saturation, and lightness.
- HEX to OKLCH ConverterTurn a HEX code into the modern OKLCH format.
- Color ConverterSee one color in every format at once.
- HEX to RGBA ConverterTurn a HEX code into RGB with transparency.
- Color Name to HEXLook up any of the 148 CSS named colors.
- Color Palette GeneratorBuild a five-color palette from one color.
- Shades GeneratorBuild 10 tints and 10 shades from one color.
- Gradient GeneratorBuild a linear or radial gradient and copy the CSS.
- Contrast CheckerCheck any text and background pair for AA and AAA.
- Color MixerMix two colors and see the result.
- Random Color GeneratorPick a random color from all 16,777,216 HEX colors.
- Color Blindness SimulatorSee your colors as color-blind users see them.
- Color ChartThe 148 named colors with HEX, RGB, and HSL.
No tool matches your search.
Frequently asked questions
Type the color in any format on this page and every other format appears at once. Enter #3B82F6 and you get RGB, HSL, HSV, CMYK, OKLCH, and a CSS variable together, each with its own copy button. Edit any field and the rest follow it.
#3B82F6 is rgb(59, 130, 246), hsl(217, 91%, 60%), hsv(217, 76%, 96%), and cmyk(76%, 47%, 0%, 4%). The OKLCH values are computed live by the tool on the page. CMYK is approximate — proof before printing.
Yes — type the HSL value into the HSL field and the HEX code updates instantly. This page converts in both directions for every format, so there is no separate HSL-to-HEX page. The same works for HSV-to-HEX, CMYK-to-HEX, and OKLCH-to-HEX.
Use the export button to copy a :root block with your color as a variable, then use var(--color) in your stylesheet. That way one change to the variable updates every place the color is used, instead of hunting through the file for bare HEX codes.
Because HSL and HSV are shown in whole numbers, and rounding can shift one or two RGB channels by 1 on the way back. The shift is under half a percent in each shifted channel and invisible to the eye. Keep the HEX code as the exact version if bit-exact values matter.
No — CMYK from a screen color is always approximate. Printers, inks, paper, and ICC profiles all change the result, and some bright screen colors cannot be printed in CMYK at all. Treat the CMYK row as a starting point and print a proof.