DNSfinder.net
HEX Converter

HEX Color Converter

Paste a hex colour code, six digits or the three-digit shorthand, and read it back as RGB, HSL, HSV and CMYK with a copy button on each. The page shows the colour, expands shorthand to the full form, grades its contrast against white and black under WCAG, and lays out five tints, five shades and a complementary colour. It is for anyone lifting colours out of a stylesheet, a brand guide or a browser inspector.

Loading HEX Color Converter...

Querying live edge resolvers and network infrastructure...

How to use the HEX Color Converter

  1. Paste a code such as #1E6FD9, 1e6fd9 or #16f into the HEX color field. The # and the letter case are optional.
  2. Copy the RGB, HSL, HSV / HSB or CMYK value from the All formats list.
  3. Check the On white and On black tiles for the contrast ratio and its AA or AAA grade.
  4. Hover a tint or shade to see its hex code, then click it to load that colour into the field.

What to look for

Shorthand is expanded for you

Enter #16f and the HEX row shows #1166FF: each digit is doubled, not padded with zeros. The output is always the six-digit uppercase form, which is the safest one to paste into software that does not understand the short notation.

Eight-digit codes are refused

A code with an alpha pair, such as #1E6FD980, turns the field red. The converter works on opaque colours only, so delete the last two digits, or the fourth digit of a #RGBA code, and convert what remains. Opacity changes none of the other values shown here.

One digit can decide AA

#767676 on white measures 4.54:1 and is graded AA. #777777 measures 4.48:1 and drops to AA Large. Neighbouring hex codes look identical on a screen, so read the ratio in the Contrast card instead of judging grey text by eye.

Guide

Reading hex colour codes, shorthand and alpha digits

How a hex code is put together

A hex colour is three bytes written in base 16 after a # sign: two digits for red, two for green, two for blue. Base 16 uses the digits 0 to 9 and then A to F for the values 10 to 15, so a pair runs from 00 to FF, the same range as 0 to 255 in decimal.

To read a pair, multiply the first digit by 16 and add the second. In #1E6FD9 the red pair 1E is 16 plus 14, or 30; the green pair 6F is 96 plus 15, or 111; the blue pair D9 is 208 plus 9, or 217. The code is therefore identical to rgb(30, 111, 217), and browsers treat both as the same sRGB colour.

With practice you can judge a code at a glance. Three equal pairs, as in #808080, mean a neutral grey. A large first pair followed by two small ones is a red, and high values in all three pairs mean a pale colour close to white.

Three-digit shorthand

CSS allows a three-digit form in which each digit is doubled: #16f is #1166ff, #fff is white and #000 is black. A common misreading pads with zeros instead and takes #16f for #10600f, which is a dark green and nowhere near the bright blue the shorthand means.

Only colours whose pairs are all doubled digits can be shortened, which leaves 4,096 of the 16.7 million. The converter expands shorthand on input and always prints six uppercase digits in the HEX row, so you can paste #16f and copy #1166FF for a tool that rejects the short form.

Alpha in four and eight digits

Current CSS adds an optional alpha value to the notation: #RRGGBBAA, with #RGBA as its shorthand. The extra pair sets opacity on the same 00 to FF scale, so FF is opaque, 00 is invisible and 80 is close to half. Percentages do not map onto it directly, which is why 50 percent opacity is written 80 and not 50.

Order is a trap when codes move between platforms. CSS puts alpha last, while Android colour resources put it first as #AARRGGBB. This converter accepts neither: any four- or eight-digit code is refused with the message Couldn't read that colour. Strip the alpha digits and convert the opaque colour underneath.

What the field accepts and what comes back

Type or paste six or three hex digits, in either case, with or without the #. The preview block shows the colour with its code printed on it, and All formats lists HEX first, then RGB, HSL, HSV / HSB and CMYK. A half-typed code shows a red outline while the panels hold the last valid colour, except at exactly three digits, which is valid shorthand.

The same field reads other notations if you paste them: three comma-separated numbers are taken as RGB, and rgb(), hsl(), hsv() and cmyk() values are converted too. One catch on this page is that three bare digits such as 123 are read as the shorthand #112233, not as numbers.

Checking a hex colour for readable text

The Contrast card puts your colour on white and on black and reports each ratio to two decimals with a grade. WCAG AA needs 4.5:1 for normal text and 3:1 for large text. AAA needs 7:1. A link blue such as #0066CC scores 5.57:1 on white and passes AA, but only 3.77:1 on black, where it is fit for large text alone.

When a brand colour misses the mark, the Shades strip offers five darker versions mixed towards black and the Tints strip five lighter ones mixed towards white. The card tests white and black backgrounds only. For print values see the CMYK Color Converter, and for adjusting hue or saturation the HSV Color Converter.

Knowledge Base & FAQ

HEX Color Converter FAQs

Common questions about the hex color converter.

Split the six digits into three pairs and read each pair as a base-16 number. In #1E6FD9, 1E is 30, 6F is 111 and D9 is 217, giving rgb(30, 111, 217). Paste the code above and the RGB row shows the result, ready to copy.