Colour Converter - HEX, RGB, HSL & OKLCH Converter
Paste any CSS colour into any field: hex (3, 4, 6 or 8 digits), rgb(), rgba(), hsl(), hsla(), oklch() or oklab(), with commas or the modern space syntax.
Convert between CSS colour formats
Type or paste a colour into any field and the others update as you type: HEX, RGB, HSL, OKLCH and OKLAB, all with alpha. The swatch sits on a checkerboard so you can see transparency. Use the colour picker or the alpha slider to adjust, and the Copy button beside each field to copy it.
What you can paste
Every field reads every format, so oklch(70% 0.15 250) pasted into the HEX box still works. Legacy comma syntax
(rgba(59, 130, 246, 0.5)) and modern space syntax (rgb(59 130 246 / 50%)) both parse, as do
percentages, decimals and the hue units deg, rad, grad and turn. Named colours such as tomato are not
recognised; paste the hex instead.
Example
Input #3b82f680 (blue at 50% opacity) gives:
HEX #3b82f680
RGB rgba(59, 130, 246, 0.502)
HSL hsla(217.2, 91.2%, 59.8%, 0.502)
OKLCH oklch(62.31% 0.188 259.81 / 0.502)
OKLAB oklab(62.31% -0.0332 -0.1851 / 0.502)
The alpha is 0.502 rather than 0.5 because the hex byte 80 is 128/255. Use 7f (0.498) or write the
alpha in rgb() if you need an exact half.
Which format to use in CSS
HEX is the usual handoff format from design tools. RGB is handy when a value comes from JavaScript or canvas pixel data.
HSL is easy to adjust by hand. For design tokens and shade scales, oklch() is the better choice: two colours
with the same L have similar contrast against white, which HSL cannot promise.
Related Tools
Epoch / Unix Timestamp Converter
Convert between Unix epoch timestamps and human-readable dates.
Regex Tester
Test regular expressions against text with match highlighting.
UUID Generator
Generate random v4 UUIDs for use in databases and APIs.
Timezone Converter
Convert times between timezones with UTC offset display and common presets.