Example: a brand orange for a slide template
A business development manager is updating a pitch deck and the brand guide gives the orange as #D9480F. The presentation software's custom colour box asks for red, green and blue.
Typing the code gives rgb(217, 72, 15) and hsl(17, 87%, 45%). The contrast lines show white text at 4.29:1, fine for large text only, and black text at 4.88:1, an AA pass. For small text on orange slides, black is the safer choice.
#D9480F
RGB rgb(217, 72, 15) HSL hsl(17, 87%, 45%) White text 4.29:1, large text only Black text 4.88:1, AA pass
Converting
Enter the HEX code
Type or paste a 3 or 6 digit code, with or without the #. Or click the colour box to choose visually.
Read RGB and HSL
The R, G and B boxes fill in, and the results show the
rgb(),hsl()and tidied HEX values.Check text contrast
Two lines give the contrast ratio with white text and with black text, and whether each passes AA.
Go the other way
Type new numbers in R, G or B and click out of the box; the HEX code updates to match.
How the conversion works
A six-digit HEX code is three pairs of base 16 digits, one pair each for red, green and blue. Each pair runs from 00 (0) to FF (255). So D9 is 13 x 16 + 9 = 217, 48 is 4 x 16 + 8 = 72 and 0F is 15.
A three-digit code is shorthand that doubles each digit: #FA0 means #FFAA00, which is rgb(255, 170, 0).
Reading the contrast results
| Result shown | Meaning |
|---|---|
| AA pass | 4.5:1 or more: fine for normal body text |
| large text only | 3:1 to 4.49:1: headings and large buttons only |
| fail | Below 3:1: avoid for text |
Questions people ask
How do I convert a HEX code to RGB?
Split the code into three pairs and convert each from base 16 to a number from 0 to 255. #D9480F gives D9 = 217, 48 = 72 and 0F = 15, so rgb(217, 72, 15). Paste the code here to get the RGB and HSL values immediately, with a copy button.
Should I use white or black text on my brand colour?
Look at the two contrast lines. Choose whichever passes AA, meaning a ratio of at least 4.5:1, for normal text. Many mid-tone oranges, greens and reds pass with black but not with white, even though white text is more common on coloured buttons.
Can I convert RGB back to HEX here?
Yes. Type values from 0 to 255 in the R, G and B boxes and move out of the box, and the HEX field updates. The separate RGB to HEX converter does the same with sliders if you prefer.
Where your data goes
Every conversion runs in your browser. The colour codes you type are not sent anywhere.
Checked against the tool on