Home / Tools / Colour converter and contrast checker

Colour converter and contrast checker

Paste a colour in any common format to get its HEX, RGB, HSL and 16-bit RGB565 values, plus how readable it is against a background.

  • Code tool
  • Runs in your browser
  • Tested 19 November 2026
  • Sources
HEX, rgb(), hsl() or RGB565 like 0xF800.

The formats

  • HEX writes red, green and blue as two hexadecimal digits each, from 00 to FF. #E8590C is red 232, green 89, blue 12. A three-digit code doubles each digit, so #FA0 is #FFAA00.
  • RGB is the same three numbers in decimal, from 0 to 255.
  • HSL is hue (0 to 360° around the colour wheel), saturation and lightness. It's easier for people to adjust: change the lightness to get a darker or lighter shade of the same colour.

RGB565 for small displays

Many small TFT screens, such as those using ST7735, ST7789 and ILI9341 controllers, use 16-bit colour. RGB565 keeps the top 5 bits of red, 6 of green and 5 of blue, packed as RRRRRGGGGGGBBBBB. Green gets the extra bit because our eyes are most sensitive to it. Libraries such as Adafruit GFX and TFT_eSPI take colours in this form, so 0xF800 is pure red and 0xFFFF is white.

Dropping bits means close colours can come out identical. The "shows as" value is what the display actually produces. Some libraries also expect the two bytes swapped, so if reds come out blue or colours look scrambled, check your library's byte order setting.

Contrast

The contrast ratio uses the WCAG 2 formula, which compares the relative luminance of two colours from 1:1 (identical) to 21:1 (black on white). WCAG level AA asks for at least 4.5:1 for normal text and 3:1 for large text (18 point, or 14 point bold) and for icons and controls. Level AAA asks for 7:1 for normal text.

Sources

Where the formulas and figures on this page come from. We test every tool against worked examples from these before publishing.