Color Converter

HEX/RGB/HSL.

Loading tool…

How colour is written on the web

The same colour has several notations. Hexadecimal — #3B82F6 — encodes red, green, and blue as two hex digits each. RGB writes those same channels as decimals from 0 to 255. HSL describes the colour instead as hue in degrees around a colour wheel, plus saturation and lightness percentages, which is far more intuitive for design work: to make a shade lighter you change one number rather than guessing at three. Print work uses CMYK, a different model entirely, based on subtractive ink rather than emitted light.

Converting between RGB and HSL is exact arithmetic; both describe the same sRGB space. CMYK is not exact, because ink gamuts and screen gamuts do not overlap perfectly — a vivid screen blue simply cannot be reproduced in process ink, so any conversion is an approximation that a proper colour-managed workflow would refine.

Why we built this tool

Designers and developers cross these notations all day: a brand guide gives Pantone and CMYK, the design file gives hex, the CSS variable wants HSL so a theme can generate hover states, and an old plugin insists on RGB.

It is quick arithmetic, and there is no reason it should involve a server — yet most online converters round-trip every keystroke through one. We do it in your browser, which makes the conversion instant, keeps unreleased brand colours off other people's machines, and works offline. That last point matters more than it sounds: this is exactly the kind of small tool you want available when you are mid-flow in a design tool with no connection.

Tips and common mistakes

  • Work in HSL when building tints and shades — changing one number keeps the hue consistent.
  • Check text and background pairs against WCAG contrast ratios: 4.5:1 for body text, 3:1 for large text.
  • CMYK output is an approximation; confirm colour-critical print work against a physical proof.
  • Hex with eight digits carries an alpha channel, which some older tools silently discard.

Open Color Converter with a link

Assistants and scripts can open Color Converter with its input already in the link, after the #, which never leaves your device:

  • #color= — a colour in any CSS notation

Example: https://mygadgets.ink/tools/color-converter/#color=.... How tool links work

Quick start: using Color Converter

  1. Enter a colour in whichever notation you have — hex, RGB, or HSL.
  2. Read the equivalent values in the other formats instantly.
  3. Adjust lightness or saturation in HSL to build tints and shades of the same hue.
  4. Copy the notation your stylesheet or design tool needs.
  5. Treat CMYK output as an approximation and confirm against a printed proof.

To pull a colour out of an image instead of typing it, use Color Picker.

The three main formats

  • HEX — #RRGGBB, two hex digits each for red, green, blue. The web default, compact, used everywhere in CSS.
  • RGB — rgb(r, g, b), the same channels as 0–255 numbers. Identical information, more readable, and rgba() adds transparency.
  • HSL — hsl(hue, saturation, lightness). A different way of thinking about color: hue is the shade (0–360° around the color wheel), saturation is how vivid, lightness is how bright.

Why HSL is worth learning

HEX and RGB are precise but not intuitive — you cannot look at #3A7BD5 and know how to make it slightly darker. HSL makes color manipulation obvious:

  • Want it darker? Lower the lightness.
  • Want it more muted? Lower the saturation.
  • Want a matching color? Keep saturation and lightness, change the hue.

This is why HSL is the format of choice for generating color variations and building harmonious palettes. Design in HSL, convert to HEX for the stylesheet.

Transparency

RGB and HSL both have alpha variants — rgba() and hsla() — that add an opacity channel from 0 (invisible) to 1 (solid). HEX can encode alpha too, as a fourth pair of digits (#3A7BD5CC), though the numeric formats are clearer for it.

Common uses

  • Translate a HEX code to RGB for a graphics program.
  • Generate darker/lighter variants via HSL.
  • Add transparency with rgba/hsla.
  • Match colors across tools that want different formats.

Related Developer Tools

Browse all Developer Tools →