About the Color Code Converter
The color code converter turns a color into all three common web formats: HEX (#FF8800), RGB (rgb(255, 136, 0)) and HSL (hsl(32, 100%, 50%)). Type a code in any of them, or pick a color, and copy the format you need for CSS, a design tool or code.
It also checks contrast. Enter a text color and a background color to see their WCAG contrast ratio and whether they pass the AA and AAA levels for normal and large text, so your text stays readable for everyone.
Everything runs in your browser; nothing you type is sent anywhere.
How to use it
- Type a color code such as #777, rgb(0 128 255) or hsl(120, 50%, 50%), or use the color picker.
- Read the color in HEX, RGB and HSL next to its preview.
- Press Copy next to the format you want.
- For contrast, enter a text color (or leave it empty to use the color above) and a background color.
- Read the contrast ratio and the AA and AAA results for normal and large text.
Features
- HEX, RGB and HSL: Reads short and long HEX, rgb() and hsl() with commas or spaces, and three plain numbers.
- Color picker: Choose a color visually and get its codes at once.
- Contrast ratio: The WCAG 2 contrast ratio of any two colors, from 1:1 to 21:1.
- AA and AAA: Pass or fail for normal and large text at both levels.
- Clear errors: Says which part of a code is wrong, such as a red value above 255.
Examples
Gray on white
#777777 on white has a ratio of 4.48:1: it passes AA only for large text.
Brand color
#1E3A8A is hsl(224, 64%, 33%); white text on it easily passes AAA.
From a design tool
Paste 255, 136, 0 to get #FF8800 and hsl(32, 100%, 50%).
Limitations and notes
- Colors with transparency (alpha), such as #FF000080 or rgba(), are not supported.
- Color names (red, blue), CMYK, LAB and other color spaces are not converted.
- HSL values are rounded to whole numbers, so converting back can move a channel by a few steps.
- The contrast check follows WCAG 2.x; it does not judge font weight, size or colour blindness for you.
Frequently asked questions
How do I convert HEX to RGB?
Type the HEX code, for example #FF8800, and read rgb(255, 136, 0) below it. Press Copy to use it.
What contrast ratio do I need?
WCAG AA asks for 4.5:1 for normal text and 3:1 for large text; AAA asks for 7:1 and 4.5:1.
What counts as large text?
Text of at least 24 px, or at least 18.66 px in bold.
Can I enter #RGB codes?
Yes. Short codes like #777 are read as #777777.
Is anything sent to a server?
No. All conversions and checks happen in your browser.