Color Code Picker
HEX, RGB and HSL Converter
Hex to RGB, RGB to Hex, and all five to HSL, HSV and CMYK are converted as you enter the color code. Also, there is a ramp of tints/shades, a contrast read out stating if text may be placed over the color, and the ability to add opacity.
- PriceFree
- Formats6
- Sign-upNone
- UploadedNothing
Color Code Picker
HEX, RGB and HSL, with contrast and a shade ramp
- On white
- —
- On black
- —
Contrast decides whether words can sit on this colour. AA wants 4.5:1 for body text.
A colour cannot pass or fail on its own. Put your text colour against your background colour and this reads the ratio the way WCAG does.
The three buttons above move a colour until the pair clears AA at 4.5:1. Hue and saturation stay put, so the colour still belongs to your palette.
Large text looks like this
Small text looks like this. It is the size most of your page is set in, so it is the size that decides whether the pair is usable. Read this line and trust your eyes as well as the number.
And this is the small print nobody designs for.
Ready. Type a colour in any of the three fields.
Guides for this tool
Articles with worked examples, tables and a short video that help you get more from this tool.
WCAG Contrast RatioWCAG contrast ratio explained: the required AA and AAA ratios, how it's calculated, and how to pass.
8 minutes of reading · video guide inside
One Color, Shown Six Ways
A color can be spelled many different ways. For example, the color blue may be written as #1B5FD1 in a style sheet; as rgb(27, 95, 209) when calling upon a canvas; and as hsl(217, 77%, 46%) when using it as a design token.
They are all referring to the same pixel. So, if you convert a hexadecimal value to an RGB value, the color does not change. Only those who can view it will change.
Each format has its own specific use, and so when you show a page with only one format and hide all of the other formats, people have to go find a different page.
The color code picker displays all of the available color codes simultaneously, and each time you change any of the color codes, it right away updates every other field.
Where Hex, RGB and HSL Each Shine
Hex is short and is easily pasted. It is what designers give to you, and it’s also the color format used by the most style sheets.
RGB is simply a way to describe each channel of a color. It works well for any program which performs math with colors such as a canvas, gradient, or shader.
HSL keeps hue and lightness on separate dials. That is the one to reach for when you want the same color a shade darker, because you change one number.
Opacity belongs to rgba and hsla rather than to hex, although an eight-digit hex carries it too. This page writes whichever form you need.
Turning a Hex Code Into RGB With Pen and Paper
A hex color is three pairs, and each pair is one channel written in base sixteen. So #1B is the red channel.
Every pair of characters becomes a value between 0 and 255. The letters a to f simply continue counting after 9, so 1B means one sixteen plus eleven, which is 27.
A three-character hex doubles each digit. Therefore #abc means #aabbcc, which is a shorthand worth knowing when you read somebody else's stylesheet.
For RGB to hex, each channel turns back into a pair of hex digits. MDN's colour value reference lists every syntax a browser accepts.
Why You See the Contrast Number Here
In addition to asking "What color is that?", the second question most often asked about a color is whether or not you can write on it. So, the answer will be placed next to the color itself, rather than being located elsewhere.

The two readings compare your color to white and to black. To pass AA, body text needs a contrast ratio of 4.5:1 or higher. But, if the text is large, a 3:1 ratio may be enough.
The thresholds that are calculated by each checker in the exact same manner come from WCAG. This checker uses the formula exactly, as opposed to rounding.
Even if a color doesn’t make good text, it may make a good background, border, or chart fill. The comment below the reading will tell you what situation you’re in.
Reading HSL Without The Maths
Hue is an angle round a colour wheel. Zero is red, 120 is green, 240 is blue, and the numbers between blend them.
Saturation sets how strong the colour looks. At 0% every hue turns grey, and at 100% it is as vivid as the screen allows.
The scale of lightness runs from 0% (pure black) to 100% (pure white). Your chosen color falls in the middle of this range at 50%. This is the reason many brands choose colors in that general vicinity.
So, a darker button has the same hue and saturation, but with less lightness. This is only one number, and the family will continue to appear similar.
When Two Colours Should Not Meet
Some pairs read badly even when the contrast number passes. Red on green is the usual example, because the ratio ignores colour blindness.
One-twelfth of all males have difficulty distinguishing between red and green. As such, any chart that uses color to differentiate its lines will be difficult for these people to use.
Instead of adding another signal, use a label, a dashed line pattern, or a geometric form to convey meaning when color cannot.
If you remove the color from your image and can still understand what is happening, then everyone will be able to understand what is happening.
One more pair catches people out: a mid grey on a mid colour. Both sit near the middle of the scale, so the ratio drops below three and the words blur into the panel behind them.
Where Each Code Ends Up
CSS can take on each of those forms, so use what works best with your file. Most teams use hex for fixed colors, but they will use hsl within calculations.
The design tools tend to use HEX format. HEX is how files are transferred from designers to developers and what the developers first copy and paste.
Mobile is different. Swift wants each channel from 0 to 1, and Android wants an eight-digit hex with the opacity in front.
That’s because this page is what allows all of those to cross over from a design file to an app without any math being done by anyone.
The Ramp Is Mixing, Not Guessing
Each step will shift your color either toward white or black, in an identical increment. This gives for a consistent hue as you adjust the light levels. This is precisely how a series of tints should function.

Watch the Color Code Picker in Use
This brief video shows each step from start to finish. Choose your language below, and switch on captions if they help.
Working With the Color Code Picker, Start to Finish
Type in whichever field you already have. The other two follow.
Paste any format
Hex with/without the # symbol; rgb with/without any punctuation; or hsl. All three of these are understood by the color picker.
Or click a shade in the colour swatch
The colored square in the bar allows you to select from your system’s pick list. Moving the square will update all of the fields simultaneously.
Set the opacity
When you go below 100, the output will change from rgba and hsla, to rgba and hsla, with a eight digit hex number next to each.
Copy what you need
Select either a single line of code, or an entire block that includes CSS, Swift and Android form examples.
What Sets This Color Code Picker Apart
Converting hex to rgb takes four lines of code. The real value lies in the extras around the picker.
Three fields, one color
Edit any field and the other two rewrite themselves. Nothing waits for a button, so you can paste and read in one motion.
Contrast built in
The ratio for white/black is listed below the color swatch. It states the "AA" verdict as words rather than numbers for interpretation.
A ready-to-use scale of tints and shades
Nine steps between four-fifths lighter and four-fifths darker; each step has its own hexadecimal value. This is typically the entire color scheme used by a component.
Opacity in every form
One number switches the output to rgba, hsla and eight-digit hex together, because different files want different ones.
It reads sloppy input
Spaces, missing pound signs (#), percent signs (%) and the new slash syntax will all be parsed correctly. So, you can copy and paste a color code from any application and it will be accepted by our system.
Nothing leaves the tab
Your computer’s internet browser will handle the color conversion for you. The brand color has not been released yet and so will not reach our website.
Working With Color Codes Sensibly
Six habits that keep a palette usable rather than merely pretty.
- Keep a single master list of your brand colours. Keep the color in a CSS variable and convert from there. Two hard-coded copies drift apart within a month.
- Change lightness, not hue. Moving the L in HSL creates a darker version of the same color. When you adjust the hex value by eye, you are changing both the hue and how similar the colors appear.
- Test the text colour before you settle on it. A brand color that fails at 4.5:1 will fail every audit you ever run. Better to learn that today than once the site is built.
- Write hex in lower case. Both cases work, so this is only about diffs. One convention keeps your version history readable.
- Keep opacity out of brand colors. The unpredictability of a color over an unknown background at 60% is too great. So, select the blended color and then test it.
- Try the colour against the background it will sit on. Your page isn’t always pure white. Compare your color to the area where your content will be placed, since that is the combination a user will see.
- Keep a mid step in reserve. A palette of only a light and a dark color runs out quickly. You use a middle value for background, borders, and inactive elements, so you will need to find another color much earlier than you may anticipate.
- Name the step, not the shade. Call it blue-600 rather than dark-blue. Then swapping the palette later changes one value instead of every name.
Five Ways A Color Goes Wrong
Each of these turns a colour decision into a bug somebody else has to find.
Trusting a screenshot
Colors picked from a compressed screenshot are off by a few points. Take them from the source file instead.
Ignoring the background
Contrast is a pair, never a single color. A blue that passes on white can fail badly on your page section.
Using opacity for a tint
Fading a color to 20% depends on whatever sits underneath. Mixing it towards white gives the same look and stays predictable.
Shipping eight-digit hex everywhere
Old browsers and many other design programs do not use the alpha pair. Use the term "rgba" whenever you are using something that will be read by an old browser.
Rounding HSL and converting back
hsl rounds to whole numbers in this case and so a round-trip of the channel will result in a change in position of that channel. You should save the hex code as your "master value".
Color Code Picker FAQ
How can I turn a hex code into RGB with pen and paper?
Break the six characters into three pairs, then read every pair as a base-16 number. So #1B5FD1 becomes 27, 95, 209. A three-character hex has each digit doubled first.
Why does my rgb to hex result differ by one?
Almost all of the time, the program rounds at some point in the process. Hexadecimal has integers from 0 to 255. So, if you get a value as a percentage or from HSL, it may be rounded up or down by one.
What do the final two characters in #RRGGBBAA control?
Opacity is the final pair of numbers that are either 00 (transparent) or ff (solid). While all modern web browsers support opacity, many older graphic design programs do not.
Which colour format belongs in my design tokens?
Hex is used for brand colors because it is precise and small. Convert to HSL to make a lighter or darker step and save the new hex instead of the calculation.
Which contrast ratio does WCAG AA expect for my text?
Under WCAG AA, body text needs a 4.5:1 ratio; text that is 24px or 19px in bold needs a 3:1 ratio. AAA needs a 7:1 ratio, and this should be aimed for with long reading.
Why does one hex code look different on my laptop and my phone?
Screens display color differently from one another and occasionally apply a "profile" to the color. But, because the code is exact, the variation is due to the screen used to view the image as opposed to the actual value of the color.
Can I get a whole palette from one colour?
The ramp in this area will give you nine steps that have the same hue and will cover most of your components. In addition, you must include a neutral grey and an accent. But, these two items are based on your personal preferences rather than calculations.
Does the Denwix picker send my colour to a server?
No, every conversion is done in your browser tab. A palette you have not opened will not be sent to this site, nor will there be a record of that conversion.
Tools For The Same Afternoon
Three that sit either side of choosing a color.
- SVG Compressor
Shrink the icon you just recolored, and strip anything hiding inside it.
- CSS Minifier
Squeeze the stylesheet your new variables landed in, without breaking calc().
- QR Code Generator
Build a code in your brand color, and check it still scans afterwards.
Read The Color, Then Use It
You can use any of these three formats (hexadecimal, RGB triple, HSL) with the color code picker. It’s free, doesn’t need an account, and stores all of the values you select locally on your computer.