Home / Free tools / Images / Colour Converter and Contrast Checker
Colour Converter and Contrast Checker
Type a colour in any format and get all the others, with a copy button each. See how readable white and black text is on it, and pick lighter or darker shades. Nothing is uploaded.
Runs in your browser. Nothing you paste or choose is uploaded or stored.
What this colour converter does
This tool converts a colour between the formats used in web design and graphics: HEX, RGB, HSL, HSV and CMYK. Type a value in any of them, use the colour picker, or pick a colour from anywhere on your screen in browsers that support it, and every other format is shown at once, each with a copy button. It also tells you how readable black or white text is on that colour, using the contrast rules of the Web Content Accessibility Guidelines, and shows lighter and darker versions you can click to use.
Everything is calculated in your browser. The colour you enter is kept in the page address, so a link to the page returns to the same colour, and it is not sent anywhere.
The formats
- HEX writes the red, green and blue amounts as three two-digit hexadecimal numbers after a hash, for example
#ff8000. Short forms such as#f80repeat each digit, and an eight-digit form such as#ff800080adds transparency. - RGB gives the same three amounts as numbers from 0 to 255, for example
rgb(255, 128, 0). With transparency it isrgba(255, 128, 0, 0.5). - HSL describes a colour by hue (the position on the colour wheel, 0 to 360 degrees), saturation (how vivid, 0 to 100%) and lightness (0% black, 100% white). It is easier to adjust by hand: to get a darker version, lower the lightness.
- HSV (also called HSB) uses hue, saturation and value, the model behind many colour pickers in design programs.
- CMYK gives cyan, magenta, yellow and black percentages, used for printing. The tool uses the simple mathematical conversion. Real printing uses colour profiles that depend on the paper and ink, so a printer's own conversion will differ, especially for bright colours.
Worked example
Load the example, #ff8000, a bright orange. Its red is 255, green 128 and blue 0, so RGB is rgb(255, 128, 0). The highest component is red, the lowest is blue, and the hue lies between red (0 degrees) and yellow (60 degrees), at half way: 30 degrees. The colour is fully saturated and its lightness is (255 + 0) / 2 / 255 = 50%, giving hsl(30, 100%, 50%). HSV is hsv(30, 100%, 100%). For CMYK, the black is 1 - 255/255 = 0%, cyan is 0%, magenta is 50% and yellow 100%. These values are checked by the tests for this page, which also confirm that converting colours to HSL and back stays within a rounding step of the original.
Text contrast and accessibility
WCAG measures contrast as a ratio between the relative luminance of two colours, from 1:1 (no difference) to 21:1 (black on white). Luminance is 0.2126 x red + 0.7152 x green + 0.0722 x blue, after each channel is converted from its gamma-encoded value to a linear one. The ratio is (L1 + 0.05) / (L2 + 0.05), with L1 the lighter. Level AA needs at least 4.5:1 for normal text and 3:1 for large text, and level AAA needs 7:1 for normal text. For the orange above, white text has a ratio of 2.52:1, which fails, while black text reaches 8.34:1, which passes everything. A famous borderline case is the grey #767676 on white: 4.54:1, the lightest grey that still passes AA, whereas #777777 just fails.
Using colours well
- Check contrast every time you pick a text or button colour. Many brand colours fail with white text.
- Do not rely on colour alone to show meaning; add text or an icon for the people, about one man in twelve, who have some colour vision deficiency.
- Build a palette from lightness steps. The row of lighter and darker versions keeps the hue and saturation and changes only the lightness, which gives consistent hover and background shades.
- Use the same colour in QR codes with care. Scanners need strong contrast; the QR code generator lets you choose colours and keeps the quiet zone.
- Product photos on a coloured background? The square product photo maker accepts a background colour, and the image to Base64 converter can embed small swatches directly in CSS.
Privacy and limits
Nothing is uploaded. The "Pick from screen" button appears only in browsers that provide an eyedropper (Chrome and Edge at the moment) and lets you click any pixel on your screen. Colour names are limited to a short list of common CSS names. Colours in other spaces, such as Display P3, LAB or OKLCH, are not covered. Other free image tools are listed on the Image tools page.
Questions
How do I convert HEX to RGB?
Split the six digits into three pairs and convert each pair from hexadecimal to a number from 0 to 255. For #ff8000 the pairs are ff, 80 and 00, which are 255, 128 and 0. The tool does this for you and also gives HSL, HSV and CMYK.
What is the difference between HSL and HSV?
Both use hue and saturation. HSL's third value is lightness, where 100% is always white. HSV's third value is the brightness of the colour, where 100% is the brightest version of the hue, not necessarily white.
Is the CMYK value accurate for printing?
It is the simple mathematical conversion. A print shop's colour profile for its paper and ink gives different values, especially for bright blues and greens, so use this for rough work and the printer's profile for final files.
What contrast ratio do I need?
WCAG level AA needs 4.5:1 for normal text and 3:1 for large text (18 points, or 14 points bold). Level AAA needs 7:1 for normal text. The tool shows the ratio and a pass or fail for white and black text on your colour.
What colour formats can I type?
HEX with 3, 4, 6 or 8 digits, rgb() and rgba() with commas or spaces, hsl() and hsla(), and common colour names such as orange or rebeccapurple. Values with transparency are supported.
Why does converting back and forth change a value by one?
Colour values are rounded to whole numbers. Converting RGB to HSL and back can therefore differ by one or two steps.
Is the colour I enter sent anywhere?
No. All conversion is done in your browser. The colour is stored in the page address only so that you can bookmark it.
Google, Merchant Center, YouTube, LinkedIn, Indeed, Glassdoor and Shopify are trademarks of their owners. Van Born Labs is independent and not affiliated with them. Google's own help pages are the final word on its rules.