Convert colors instantly between HEX, RGB, HSL, HSV and CMYK with live preview and professional color tools. Everything runs locally in your browser.
HEX
RGB
—
100%
Enter a color value or generate a random color to begin.
No colour yet — type one above, or press Random.
Converted in your browser — nothing is uploaded.
Everything happens locally in your browser. No data is uploaded or stored — the colour history is kept in this browser and never leaves your device.
What is a color converter?
A color converter takes one colour written in one notation and gives you the same colour written in all the others — it starts from a value you already have, where the colour picker is for choosing one in the first place. Paste #4F46E5 and get back rgb(79, 70, 229), hsl(243, 75%, 59%), hsv(243, 69%, 90%) and cmyk(66%, 69%, 0%, 10%) — five ways of describing one indigo.
The reason a tool is needed at all is that the software involved in making anything disagrees about how to write colours down. A design file speaks HSB, a browser speaks hex and HSL, a print shop wants CMYK, an Android resource file wants eight hex digits with the alpha first, and a Tailwind project wants the name of a shade. None of these is wrong. They are all the same colour.
This one runs entirely in your browser. Conversion is arithmetic — a few dozen floating-point operations — so there is no server to send anything to and no API behind it. Load the page, disconnect from the network, and it keeps working.
How color conversion works
Every format here describes the same thing: how much red, green and blue light a pixel emits. The formats differ in how they address that point, not in what they can reach. So conversion is a change of coordinates, and it happens in three steps.
1. Parse into sRGB. Whatever you typed is read into three numbers between 0 and 255, plus an alpha. Hex is a base-16 spelling of those numbers; HSL and HSV are trigonometry around them; CMYK is subtraction from them.
2. Hold the colour in one place. There is exactly one authoritative value, and every row on screen is derived from it. That is what keeps eight fields consistent — nothing is converted twice, so nothing can disagree.
3. Format on the way out. Each row rounds and writes the canonical value in its own notation, at the moment it is displayed.
Two consequences follow, and both are worth knowing. First, converting is lossless between the RGB-based formats: hex, RGB, HSL and HSV all describe the same 8-bit-per-channel colour, so a round trip returns exactly what you started with. Second, the notations that carry no alpha channel — hex, RGB and HSL — lose the opacity, which is why the tool marks those rows rather than letting you discover it later.
CMYK is the exception in the other direction. It is not another way of writing an sRGB colour; it is a different model entirely, describing ink on paper rather than light from a screen. The conversion is a useful approximation and is described honestly as one below.
Supported color formats
Eight formats in, eight formats out, plus oklch() and the CSS colour keywords as input.
HEX
Six hexadecimal digits behind a hash, two per channel. #4F46E5 is red 4F, green 46, blue E5 — which are 79, 70 and 229 in decimal. Base 16 is used because two digits cover exactly one byte, so each channel gets a fixed-width field. The three-digit shorthand #4AE expands by doubling each digit, so it can only express 4,096 of the 16.7 million colours.
HEXA
Hex with a fourth pair for alpha, from 00 (invisible) to FF (opaque). #4F46E5CC is that indigo at 80%, because CC is 204 and 204/255 is 0.8. Every current browser supports it. Watch for the ordering trap: Android writes #AARRGGBB, with alpha first, and CSS writes #RRGGBBAA, with alpha last.
RGB
The three channels as decimal numbers from 0 to 255. Identical in meaning to hex and easier to do arithmetic on, which is why it is what most code manipulates internally. Modern CSS also accepts a space-separated form — rgb(79 70 229) — and percentages instead of numbers.
RGBA
RGB with an alpha channel from 0 to 1. Note what alpha is not: it is not a lightening of the colour, it is a blend instruction. The same rgba(79, 70, 229, 0.5) renders as a pale lilac on white and a deep navy on black — which is exactly why the preview here shows the colour on light, checkerboard and dark backgrounds at the same time.
HSL
Hue as an angle on the colour wheel, then saturation and lightness as percentages. Its advantage is that it is editable by hand: a hover state is the same hue at ten percent less lightness, which is a one-character change in HSL and a guess in hex. 0% lightness is always black and 100% is always white, whatever the hue.
HSLA
HSL with an alpha channel, following the same rules as RGBA.
HSV
Also called HSB, and it is what the picker in Photoshop, Figma and Sketch shows you. Hue is the same angle as in HSL; the other two differ. Value is simply how bright the brightest channel is, so 100% value is the pure hue rather than white. This is why a colour copied out of a design tool as “69% saturation, 90% brightness” does not match the “75%, 59%” a browser reports for the same pixel — they are two different measurements, not a mistake.
CMYK
Cyan, magenta, yellow and key — black — as ink percentages. Subtractive rather than additive: ink removes light where a screen adds it, which is why 0% of everything is white paper and 100% of everything is a soggy black. Treat the numbers here as a first approximation; see the section below for why an exact conversion is not possible without a profile.
HEX vs RGB vs HSL vs HSV vs CMYK
All seven rows below are the same colour. The differences are in what each notation makes easy, and in what it cannot say at all.
Format
The same colour
Model
Alpha
Range
Best for
HEX
#4F46E5
sRGB
No
00–FF per channel
Fixed brand colours and anything that has to travel
HEXA
#4F46E5CC
sRGB
Yes
00–FF per channel
Translucency written as compactly as possible
RGB
rgb(79, 70, 229)
sRGB
No
0–255 per channel
Reading a value off a screen or out of code
RGBA
rgba(79, 70, 229, 0.8)
sRGB
Yes
0–255, alpha 0–1
Overlays, scrims and anything that sits on top
HSL
hsl(243, 75%, 59%)
sRGB, cylindrical
No
0–360°, 0–100%, 0–100%
Deriving a family of shades from one colour
HSV
hsv(243, 69%, 90%)
sRGB, cylindrical
No
0–360°, 0–100%, 0–100%
Matching what a design tool's picker shows
CMYK
cmyk(66%, 69%, 0%, 10%)
Subtractive, device-dependent
No
0–100% per ink
Reasoning about print — not the final separation
The short version: hex when the colour is fixed and has to travel, HSL when you are going to derive other colours from it, RGBA or HEXA when it needs transparency, HSV when you are matching what a design tool shows, and CMYK only as a step towards a proper colour-managed separation.
HEX to RGB converter
The most-searched colour conversion there is, and the simplest: hex and RGB are the same three numbers written in different bases. Splitting the six digits into three pairs and reading each pair as base 16 is the whole algorithm.
Nothing is approximated and nothing is lost — both formats describe 8 bits per channel, so the conversion is exact in both directions. The one thing to watch is the shorthand: #4AE means #44AAEE, not #04A0E0. Each digit is doubled rather than padded, which keeps #FFF pure white.
To do it here: paste the hex value into the input box and read the RGB row. The input accepts it with or without the hash, in either case, and in the three-, four-, six- or eight-digit form.
RGB to HEX converter
The same operation run backwards: each channel is written as two hexadecimal digits and the three are concatenated behind a hash. The only detail that matters is padding — 10 is 0A, not A — because a five-digit hex value is not a colour and browsers will ignore the whole declaration.
Type rgb(79, 70, 229) into the input box — or just 79, 70, 229 into the RGB row, since each output row parses in its own space — and copy the HEX row. Percentages work too: rgb(31%, 27%, 90%) resolves to the same colour, rounded to the nearest byte.
RGB to HSL converter
This one is a genuine change of shape rather than a change of base. RGB is a cube; HSL is a cylinder around it. The conversion finds the brightest and dimmest of the three channels and derives all three HSL components from them.
Lightness is the midpoint of the brightest and dimmest channels. For our indigo that is (229 + 70) / 2 / 255, which is 59%.
Saturation is how far apart those two channels are, scaled by how close the lightness is to the middle. A colour with all three channels equal has zero saturation and is a grey.
Hue is an angle, decided by which channel is the brightest — red anchors 0°, green 120°, blue 240° — and how far the other two are from it. Blue is brightest here, giving 243°.
Hue is where the two round trips can differ by a degree, and harmlessly. Many HSL triples map to the same 8-bit pixel: hsl(243, 75%, 59%) and hsl(244, 76%, 59%) are both #4F46E5. The tool keeps the colour and shows the canonical spelling of it.
HEX to CMYK converter
Screens add light; ink removes it. That difference is the whole of the conversion, and also the reason it can only ever be approximate without a colour profile.
The K channel is the interesting part. Cyan, magenta and yellow together should make black, and in practice they make a muddy brown that uses three times the ink and takes three times as long to dry. Pulling the common darkness out into a dedicated black plate — called grey component replacement — is why CMYK has four inks rather than three.
Do not send these numbers to a printer.Real CMYK depends on the ink set, the paper, the press and a total ink limit that this conversion knows nothing about, and the same values look visibly different on newsprint and on coated stock. There are also colours a screen can show that no ink can — bright cyans and vivid greens especially — so some conversions are approximations of something unreachable. Use these figures to reason about a colour, and get the real separation from your printer’s profile in a colour-managed application.
If the colour is headed for a background rather than a press, the CSS gradient generator blends two or more of these values into a gradient and writes the rule for it.
CSS color formats
CSS accepts more colour notations than any other language, and the modern syntax is quietly different from the one most examples still use.
The comma-separated form with a separate rgba() function is CSS Color 3. In CSS Color 4 the separators became spaces, alpha moved behind a slash, and the a variants became aliases — rgb() now takes alpha directly. Both work everywhere; the newer form is what modern tooling emits.
The only form that can be changed at runtime, which is what makes theming possible. Storing the channels rather than the whole colour lets one variable serve both the solid and the translucent case. A stylesheet full of them is worth running through the CSS formatter so the declarations line up consistently.
Perceptually uniform, which HSL is not: in HSL, hsl(60, 100%, 50%) yellow and hsl(240, 100%, 50%) blue claim the same lightness and look nothing alike. OKLCH fixes that, so equal numeric steps produce equal visual steps — which is why Tailwind v4 defines its entire palette in it. This tool accepts oklch() as input and converts it to everything else.
1/* the same indigo, and a ramp that steps evenly */2color: oklch(51.1% 0.262 276.97);34--step-1: oklch(70% 0.18 277);5--step-2: oklch(60% 0.22 277);6--step-3: oklch(50% 0.26 277);
Common use cases
Anywhere two pieces of software disagree about how to write a colour down.
Web development
Turning the hex a designer handed over into the rgba() a component needs, or into the HSL that makes a hover state one lightness step away rather than a second value to maintain.
CSS and stylesheets
Writing a colour the way the stylesheet wants it. The Code panel emits declarations, a custom property block and a Sass variable from the same colour, so nothing is retyped and nothing drifts.
Tailwind CSS
Finding out that the colour in the mockup is indigo-600 and can be a class rather than an arbitrary value — or that it is 21 units away from the nearest shade and deserves a theme token, which the tool writes for you.
UI design
Moving between the HSV a design tool shows and the HSL a browser understands, without doing the conversion in your head or discovering the difference the hard way.
Branding
Publishing one brand colour in every notation a guideline needs: hex for the web, RGB for screens, CMYK for print and the closest named colour for the description underneath.
Graphic design
Carrying a colour between applications that disagree about notation — one wants HSB, another wants RGB percentages, a third wants a hex string — with a single source for all of them.
Print design
Getting a first approximation of the ink mix behind a screen colour, and seeing immediately when a vivid RGB colour is going to be a problem on paper long before the proof comes back.
Mobile apps
Matching a colour to the Material palette so it can be named in a theme rather than hard-coded, and converting to the 8-digit hex that Android resource files use for translucency.
Frequently asked questions
Is this Color Converter free?
Yes. Every format, every conversion and every export is free, with no account, no usage cap and nothing held back. There is no paid tier.
How do I convert HEX to RGB?
Paste the hex value into the input box and read the RGB row. The conversion is direct: each pair of hex digits is one channel written in base 16, so #4F46E5 splits into 4F, 46 and E5, which are 79, 70 and 229 in decimal. Nothing is approximated, and the round trip back to hex is exact.
How do I convert RGB to HEX?
Type rgb(79, 70, 229) — or just 79, 70, 229 into the RGB row — and copy the HEX row. Each channel is converted to two hexadecimal digits and the three are concatenated behind a hash. Because both formats describe the same 8 bits per channel, no information is lost in either direction.
Do I need to say which format I am pasting?
No. The input box detects the format and tells you what it found, so #4F46E5, rgb(79 70 229), hsl(243deg 75% 59%), cmyk(66, 69, 0, 10), rebeccapurple and oklch(51.1% 0.262 276.966) all just work. The only place the format matters is inside the output rows, where each row parses in its own space — which is deliberate, because three numbers like 244, 69%, 90% are a valid HSL colour and a valid HSV colour, and they are not the same colour.
Can I convert in the other direction?
Every output row is an editable field, so conversion runs in whichever direction you type. Change the CMYK row and the hex, RGB, HSL and HSV rows all follow; change the HSL row and CMYK follows. That is what makes all twelve pairs — HEX ⇄ RGB, RGB ⇄ HSL, HSL ⇄ HSV, HSV ⇄ CMYK and the rest — real rather than advertised.
What is the difference between HSL and HSV?
They share a hue and disagree about the other two. In HSL, lightness is the midpoint between the brightest and dimmest channel, so 100% lightness is always white and 50% is the pure hue. In HSV, value is simply how bright the brightest channel is, so 100% value is the pure hue and white only happens when saturation is also 0. HSL is the one CSS speaks; HSV — which Adobe calls HSB — is what the colour picker in Photoshop and Figma shows you.
Why is my HSL slightly different from what I typed?
Because the colour is stored as something a screen can display. HSL has infinitely many values that round to the same pixel: hsl(243, 75%, 59%) and hsl(244, 76%, 59%) are both #4F46E5 once they have been reduced to 8 bits per channel. When you type one in, the tool keeps the colour and shows you the canonical way of writing it, which is usually within a degree or a percent of what you entered.
Is the CMYK conversion accurate for printing?
It is the standard naive conversion, and it is not print-ready. Real CMYK depends on a colour profile, the ink set, the paper and the total ink limit, so the same values produce visibly different results on newsprint and on coated stock. Use these numbers for reasoning about a colour and for a rough idea of its ink mix; get the actual separation from your printer's profile in a colour-managed application.
What is HEXA, and when would I use it?
Hex with two more digits on the end for alpha, from 00 (invisible) to FF (opaque). #4F46E5CC is that indigo at 80%. Every current browser supports it, and it is the most compact way to write a translucent colour — though rgba() is easier to read when the alpha is doing something interesting.
Why does the HEX row not show my opacity?
Because six-digit hex has nowhere to put it. When the opacity is below 100% the tool marks the rows that cannot carry it — HEX, RGB and HSL — so you can see what is being dropped rather than discovering it later in a build. HEXA, RGBA and HSLA all keep it.
What does the closest color name mean?
The nearest of the 148 colour keywords CSS recognises. When your colour is one of them exactly, it says so; otherwise it is the closest match, measured in a hue-weighted space rather than by raw RGB distance — which matters, because RGB distance will confidently tell you a mid orange is olive.
How is the closest Tailwind color found?
By comparing your colour against every shade in Tailwind's default palette and reporting the nearest, with the distance alongside so a poor match is visible as one. The palette is generated from the installed version of Tailwind, which defines its colours in OKLCH — so the hex values shown are what an sRGB screen renders, and the most saturated shades are slightly clipped from the source.
Which Material Design palette is matched?
The 2014 palette — nineteen families of ten shades, plus the four accents on the sixteen families that have them. Material 3 replaced fixed swatches with tonal palettes generated from a source colour, so there is no fixed list to match against; when someone asks for the Material colour, this is the set they mean.
What is relative luminance, and how is it different from brightness?
Relative luminance is the WCAG measure of how much light a colour emits, from 0 for black to 1 for white, weighted for how sensitive the eye is to each channel. It is the number contrast ratios are calculated from. Brightness is a looser idea with two common definitions — the V in HSV, and the older BT.601 weighting — and neither is what an accessibility audit will use. All three are shown, labelled.
Does the tool upload my colors anywhere?
No. Every conversion is arithmetic running in your browser, there is no API behind it, and no request is made when you convert, copy or download. Load the page, disconnect from the network, and it keeps working.
Where is my color history stored?
In your browser's local storage, on your own device. It survives a refresh so you do not lose a colour you were working with, it is never sent anywhere, and clearing it removes it. Nothing about it reaches a server.
Can I convert a color name like rebeccapurple?
Yes — type any of the 148 CSS keywords and it resolves. The search panel goes the other way too: search by name or by hex to find a colour, with matches highlighted as you type.
What does the checkerboard behind the preview mean?
Transparency. Without it a colour at 20% opacity is indistinguishable from a pale one, which is exactly the mistake the preview exists to prevent. The dark and light backgrounds alongside it show how the same colour reads in both themes, which is where translucent colours usually go wrong.
Can I generate CSS variables from a color?
Yes. The Code panel writes CSS declarations, a SCSS variable, a :root custom property block and a Tailwind v4 @theme block, all named from a field you control. Each is one click to copy, and the value switches from hex to rgba() automatically once the colour has opacity.
What is OKLCH, and why does the tool accept it?
A perceptually uniform colour space, which means equal numeric steps look like equal visual steps — something HSL badly fails at. Tailwind v4 defines its entire palette in it and modern CSS supports it, so pasting an oklch() value in is now an ordinary thing to do. It is accepted as input and converted; it does not get an output row of its own.
Why do some colors say they are out of gamut?
Because OKLCH and CMYK can both describe colours a standard screen cannot show. When that happens the value is clipped per channel to the nearest thing sRGB can display, which is what a browser does too — so what you see is what you would get, but it is not exactly what the source described.
Which format should I use in CSS?
Hex for a fixed brand colour, because it is the most portable and the most recognisable. HSL when you want to derive a family from one colour, since changing lightness by hand is trivial and changing it in hex is not. RGBA or HEXA when you need transparency. OKLCH when you want a ramp whose steps look evenly spaced, which is what Tailwind v4 moved to.
Can I use this for accessibility checks?
Partly. The luminance and the readable-text recommendation are computed the same way WCAG does, so they will agree with an audit. For a full contrast check against a specific background — with the AA and AAA thresholds for both normal and large text — use the Color Contrast Checker, which is built for that job.
Does it work on a phone?
Yes. The layout collapses to a single column with a switch between the converter and the panels, the fields use the right keyboard, and everything runs locally, so a slow connection makes no difference once the page has loaded.
Does this work offline?
Once the page has loaded, yes. Conversion, matching, copying and downloading are all local, so it keeps working with the network disconnected.
Keep going
Tools that pair with this one
Same privacy model — everything below runs in your browser too.