HEX, RGB, HSL and OKLCH — converted as you type
Paste a colour in any format and read it in every other one. Hex codes, rgb() with commas or without, hsl(), oklch(), CSS colour names, or three bare numbers copied out of a design tool. Underneath there is a contrast checker that tells you which WCAG thresholds a pair of colours actually passes, rather than giving one vague grade. Everything runs in this tab — nothing is uploaded or saved.
- Nothing is uploaded or saved
- Works offline
Your colour
Closest CSS colour name
dodgerblue — nearest, visibly different
Tints and shades
Same hue, OKLCH lightness 0.97 down to 0.19. Tap one to load it.
Every format
Checking whether two colours can actually be read together? The contrast checker gives the ratio and which WCAG thresholds it clears, with real text at both sizes.
How it works
- 1
Paste the colour you have
Any of these work: #fff, #FFFFFF, rgb(59 130 246), the older rgb(59, 130, 246), hsl(217 91% 60%), oklch(0.62 0.19 260), a CSS name like tomato, or just 59, 130, 246 pasted out of a colour picker. There is no format menu to set first — the field works out what you gave it. If it cannot, it says so in a sentence instead of showing a black swatch and hoping you notice.
- 2
Read it in every other format
All five notations update on every keystroke, each with its own copy button. The large swatch is the colour itself, at a size where you can actually judge it. Modern rgb() and the legacy comma form are both listed, because plenty of tooling and email clients still refuse the newer syntax.
- 3
Take the tints and shades if you need a scale
The strip under the swatch holds the same hue at ten perceptual lightness steps. They are generated by moving OKLCH lightness and keeping hue and chroma, not by mixing towards white and black in sRGB — which is why none of the steps has that muddy, slightly-wrong look that hand-mixed scales tend to develop in the middle.
- 4
Check the pair you plan to use
The contrast section takes a text colour and a background colour and reports the ratio, which of the four published WCAG thresholds it clears, and what the text will actually look like at both sizes. Swap the two with one button. A number on its own does not tell you whether something is readable; the preview does.
Common colours in every format
Every row below is produced by the same conversion code as the tool above, so the two cannot disagree. The OKLCH column is the one worth reading twice: compare the lightness of yellow against the lightness of blue, then look at what HSL claims about the same two colours.
| Name | HEX | RGB | HSL | OKLCH |
|---|---|---|---|---|
| black | #000000 | rgb(0 0 0) | hsl(0 0% 0%) | oklch(0 0 0) |
| white | #ffffff | rgb(255 255 255) | hsl(0 0% 100%) | oklch(1 0 0) |
| gray | #808080 | rgb(128 128 128) | hsl(0 0% 50%) | oklch(0.59987 0 0) |
| silver | #c0c0c0 | rgb(192 192 192) | hsl(0 0% 75%) | oklch(0.8078 0 0) |
| red | #ff0000 | rgb(255 0 0) | hsl(0 100% 50%) | oklch(0.62796 0.25768 29.23) |
| crimson | #dc143c | rgb(220 20 60) | hsl(348 83% 47%) | oklch(0.57119 0.22194 20.09) |
| tomato | #ff6347 | rgb(255 99 71) | hsl(9 100% 64%) | oklch(0.69622 0.19552 32.32) |
| orange | #ffa500 | rgb(255 165 0) | hsl(39 100% 50%) | oklch(0.79269 0.17103 70.67) |
| gold | #ffd700 | rgb(255 215 0) | hsl(51 100% 50%) | oklch(0.88677 0.18219 95.33) |
| yellow | #ffff00 | rgb(255 255 0) | hsl(60 100% 50%) | oklch(0.96798 0.21101 109.77) |
| lime | #00ff00 | rgb(0 255 0) | hsl(120 100% 50%) | oklch(0.86644 0.29483 142.5) |
| green | #008000 | rgb(0 128 0) | hsl(120 100% 25%) | oklch(0.51975 0.17686 142.5) |
| teal | #008080 | rgb(0 128 128) | hsl(180 100% 25%) | oklch(0.54312 0.09271 194.77) |
| cyan | #00ffff | rgb(0 255 255) | hsl(180 100% 50%) | oklch(0.9054 0.15455 194.77) |
| dodgerblue | #1e90ff | rgb(30 144 255) | hsl(210 100% 56%) | oklch(0.65201 0.19012 253.21) |
| blue | #0000ff | rgb(0 0 255) | hsl(240 100% 50%) | oklch(0.45201 0.31321 264.05) |
| navy | #000080 | rgb(0 0 128) | hsl(240 100% 25%) | oklch(0.27115 0.18789 264.05) |
| indigo | #4b0082 | rgb(75 0 130) | hsl(275 100% 25%) | oklch(0.33898 0.17927 301.68) |
| rebeccapurple | #663399 | rgb(102 51 153) | hsl(270 50% 40%) | oklch(0.44027 0.1603 303.37) |
| magenta | #ff00ff | rgb(255 0 255) | hsl(300 100% 50%) | oklch(0.70167 0.32249 328.36) |
| hotpink | #ff69b4 | rgb(255 105 180) | hsl(330 100% 71%) | oklch(0.7283 0.19708 351.99) |
| brown | #a52a2a | rgb(165 42 42) | hsl(0 59% 41%) | oklch(0.48061 0.15966 25.56) |
Frequently asked questions
Why is HSL lightness not the same as brightness?
Because HSL is a rearrangement of the RGB cube, not a model of vision. Its lightness is simply the midpoint between the largest and smallest of the three channels, so hsl(60 100% 50%) — pure yellow — and hsl(240 100% 50%) — pure blue — both claim 50% lightness. Put them side by side and the yellow is dazzling while the blue is nearly as dark as the text you are reading. The eye is far more sensitive to green than to blue, and HSL knows nothing about that. This is why a palette built by holding HSL lightness fixed and spinning the hue produces a set of colours that will not sit together, and why the same trick in OKLCH does.
What makes OKLCH different, and is it worth switching to?
OKLCH is the polar form of OKLab, a colour space fitted to how people actually judge differences between colours. Its L really is perceived lightness: two colours with the same L look equally light regardless of hue, so oklch(0.7 0.2 30) and oklch(0.7 0.2 250) are a red and a blue of genuinely matching weight. C is chroma, roughly how far the colour is from grey, and H is hue in degrees. The practical payoff is that lightness scales, hover states and accessible pairs can be derived arithmetically instead of eyeballed. It is worth switching when your tooling supports it — Tailwind CSS v4 emits its default palette in oklch(), which is a large part of why the format is spreading. This site is built on Tailwind v4, so the values you copy here are the same notation its own theme uses.
What does a hex code actually mean?
Three bytes, written in base 16. #3B82F6 is 0x3B red, 0x82 green, 0xF6 blue — 59, 130 and 246 in ordinary decimal, which is exactly what rgb(59 130 246) says in words. Two hex digits cover 0–255, one byte, so a six-digit code is three bytes and nothing more. The short form #FFF is not a different system either: each digit is doubled, so #FFF is #FFFFFF and #ABC is #AABBCC. That doubling is also why the short form cannot express most colours — it only reaches 4,096 of the 16,777,216 a full code can. A code with eight digits carries a fourth byte for transparency; this page drops it, because how see-through a colour is only means something once you know what sits behind it.
What does "outside the sRGB gamut" mean when I type an OKLCH value?
OKLCH can name colours that no ordinary monitor can produce. Chroma has no upper limit in the notation, but a screen only has three primaries to mix, and the most saturated green sRGB can reach is fixed by its green primary. Ask for oklch(0.8 0.3 140) and you have described a green more saturated than that primary allows — real to your eye, unreachable on the display. When that happens this page says so rather than quietly clamping, and it shows you the nearest colour sRGB can reach: same lightness, same hue, chroma pulled back until it fits. Clamping each channel instead, which is what most converters do silently, shifts the hue as well, so you get a different colour presented as though it were yours. On a wide-gamut display the browser may be able to show more, but a hex code cannot describe it — hex is sRGB by definition.
Where does 4.5:1 come from, and what counts as large text?
The contrast ratio compares the relative luminance of two colours, on a scale from 1:1 (identical) to 21:1 (black on white). WCAG 2 sets 4.5:1 as the AA threshold for normal text: it is roughly the contrast a person with 20/40 vision needs to read as comfortably as someone with normal sight reads text at 3:1. AAA raises that to 7:1. Large text gets easier thresholds — 3:1 for AA and 4.5:1 for AAA — because thicker letterforms survive lower contrast. "Large" means 18 point or larger, or 14 point or larger if bold, which in CSS is roughly 24px, or 18.66px bold. Note that the ratio ignores hue completely: it is computed from luminance alone, so a red and a green that look violently different to the eye can sit at nearly 1:1 and be genuinely unreadable together.
Why do the HSL numbers not always convert back to the same hex?
Because whole-number HSL is a coarser grid than 24-bit RGB. There are 16,777,216 sRGB colours but only 360 × 101 × 101 whole-number HSL triples, and they are not distributed evenly, so several hex codes share one rounded HSL value. Converting hex to HSL and straight back can therefore land up to a few steps away on a channel. This page prints HSL rounded to whole degrees and whole percentages because that is what every design tool shows and what people expect to copy. The OKLCH values are different: they carry five decimal places precisely so that pasting one back into the box returns the hex it came from, which was checked against all 16,777,216 sRGB colours rather than assumed.
Which formats can I paste in?
Hex with or without the # and in 3, 4, 6 or 8 digits. rgb() and rgba() in both the modern space-separated form and the legacy comma form, with channels as numbers or percentages. hsl() and hsla() the same way, with the hue in deg, turn, rad or grad. oklch(), with lightness as 0–1 or as a percentage and hue in any angle unit. Any of the 148 CSS colour keywords, including both spellings of grey and rebeccapurple. And three bare numbers, comma or space separated, which is what lands on your clipboard when you copy out of a picker. Where a value is out of range it is clamped and the page says which one it clamped and why.
Is anything sent anywhere, or stored?
No. The conversion, the tint scale, the nearest colour name and the contrast maths all run in this tab as ordinary JavaScript, and nothing you type is written to storage — reload the page and it is gone. The page does carry Google AdSense, which loads from Google and sets its own cookies like any ad-supported site; that is a request the browser makes for the advertising, and it never receives the colours you typed. The /privacy page describes exactly what does and does not happen.