Skip to content
Filebird

Color converter

HEX, RGB and HSL, plus a contrast checker

Files never leave your device

Designers hand over HEX codes, CSS wants RGB or HSL, and a brand guide uses a named color you cannot quite match by eye. This converter keeps all of those formats in sync. Type a value in any one and the others update, or pick a color with the visual picker. It also includes a contrast checker that compares two colors the way accessibility guidelines do, so you can find out whether grey text on a white background is readable before it ships.

How to convert a color and check its contrast

  1. Enter a color in whichever format you have: a HEX code, RGB values, HSL values or a CSS color name. You can also click the picker and choose visually.
  2. Read the other formats. Copy the one your stylesheet, design tool or document needs.
  3. To check readability, set one color as the text and another as the background in the contrast section.
  4. Look at the ratio and the pass or fail marks for the AA and AAA levels, for normal and large text.
  5. Adjust lightness until the ratio passes, which is easiest to do in HSL, then copy the new value.

Options explained

  • HEX: A six-digit code like #1A73E8, two digits each for red, green and blue. Three-digit shorthand such as #0af expands to #00AAFF. It is the most common format in web design.
  • RGB: Red, green and blue as numbers from 0 to 255. Useful when you need to see the actual channel amounts or write rgb() in CSS.
  • HSL: Hue (the color wheel angle from 0 to 360), saturation (how vivid) and lightness (how light or dark). It is the most human-friendly format for tweaks: raise lightness for a lighter shade without changing the hue.
  • CSS names: Words such as tomato, teal or rebeccapurple. If your color exactly matches one it is shown; otherwise only the numeric formats apply.
  • Color picker: A visual way to choose a value when you do not know a code. The result flows into all the formats.
  • Contrast ratio: A number from 1:1 (identical colors) up to 21:1 (black on white). WCAG asks for at least 4.5:1 for normal text at level AA and 7:1 at level AAA. Large text, roughly 24 px regular or 19 px bold and above, needs 3:1 for AA and 4.5:1 for AAA.

Tips and common problems

Rounding is normal: Converting HEX to HSL and back can shift a value by one unit because HSL numbers are rounded. If you need the exact original, keep the HEX code as your source of truth.

Contrast depends on both colors: A shade that works on white may fail on a light grey card. Test text against the real background it will sit on.

Passing the ratio is not the whole story: Very thin fonts, small sizes and busy backgrounds can still be hard to read at a passing ratio. Treat the numbers as a floor, not a guarantee.

Do not rely on color alone: Use labels, icons or underlines for things like error states or links, since some people cannot distinguish certain hues. The ratio check helps with brightness, not color blindness.

Hidden alpha: Semi-transparent colors blend with what is behind them, so the displayed result changes. Check contrast using the final blended color, not the original value.

Sampling a color from a picture? Use the Color picker to read any pixel from an image, then bring the value here to convert it or test it against your background.

Your files stay on your device

Every conversion and contrast calculation runs in your browser as you type. The colors you enter are not sent anywhere or stored, and no extra data is downloaded to compute them. See How it works for how local processing is handled across the site.

Frequently asked questions

What is the difference between HEX and RGB?

They describe the same thing. HEX writes the three channels in base 16, such as #FF8800, while RGB writes them in base 10 as rgb(255, 136, 0). Browsers treat them identically.

What contrast ratio do I need?

For ordinary body text, aim for at least 4.5:1 to meet WCAG AA. For large headings 3:1 is enough at AA. If you want to meet AAA, aim for 7:1 for normal text.

Why does my converted HSL look slightly different?

HSL values are rounded to whole numbers, so converting back may differ by one step in a channel. The change is invisible to the eye.

Are three-digit hex codes supported?

Yes, shorthand like #fa0 expands to #ffaa00 by doubling each digit.

Does the picker show the same color on every screen?

The values are identical, but displays vary in calibration, so the same code can look slightly different between devices.

Can I check contrast for non-text elements?

Yes. The same math applies to icons and form borders; WCAG suggests a minimum of 3:1 for those interface components.