Skip to content
Popular Calculators
Browse Other calculators

Color Converter

Convert colours between HEX, RGB, HSL, HSV and CMYK, with the colour's luminance and whether white or black text reads best on it.

HEX, rgb(…) or hsl(…).

About the Color Converter

Colours on screens and in print are described in several different systems. Web designers write HEX codes such as #1E90FF, programmers use RGB values, designers often think in HSL or HSV because they match how we describe colours — hue, how vivid, how light — and printers work in CMYK inks. Moving between them by hand means base-16 arithmetic and formulas nobody remembers.

This color converter takes a colour as HEX, RGB or HSL and gives it in every common format: HEX, RGB, HSL, HSV/HSB and CMYK. It also shows the colour's relative luminance and whether white or black text reads better on it, with the contrast ratio.

How to Use the Color Converter

Enter a colour in any of these forms:

HEX, with or without #, in six or three digits: #1E90FF or #1EF.

RGB: rgb(30, 144, 255).

HSL: hsl(210, 100%, 56%).

How Colours Are Converted

  HEX → RGB     each pair of hex digits is a number from 0 to 255 (base 16)
  RGB → HSL     lightness = (max + min) ÷ 2
                saturation = (max − min) ÷ (1 − |2 × lightness − 1|)
                hue from which channel is largest
  RGB → HSV     value = max, saturation = (max − min) ÷ max
  RGB → CMYK    K = 1 − max; C = (1 − R − K) ÷ (1 − K), and the same for M and Y

Step-by-Step Example

#1E90FF (dodger blue)

  RGB:    1E = 30, 90 = 144, FF = 255     →  rgb(30, 144, 255)
  HSL:    hue 210°, saturation 100%, lightness 56%
  HSV:    hue 210°, saturation 88%, value 100%
  CMYK:   88% cyan, 44% magenta, 0% yellow, 0% black
  Text:   black text, contrast 6.49:1 (white would be 3.24:1)

Understanding the Colour Models

HEX and RGB describe how much red, green and blue light a screen emits, each from 0 to 255. HEX is simply RGB written in base 16, two digits per channel, which is why it is compact and popular in web code.

HSL — hue, saturation, lightness — describes colour the way people talk about it. Hue is the position on the colour wheel in degrees (0 red, 120 green, 240 blue), saturation how vivid it is, and lightness how close to black or white. It makes it easy to create lighter or darker shades of the same colour by changing just lightness.

HSV, also called HSB, uses value or brightness instead of lightness. Many design tools' colour pickers use HSV.

CMYK describes the cyan, magenta, yellow and black inks used in printing. Because screens add light and printing subtracts it, some bright screen colours cannot be printed exactly.

Short Hex Codes

A three-digit hex code is shorthand where each digit is doubled: #1EF is #11EEFF and #FFF is white. It only works when both digits of each pair are the same. Eight-digit hex codes add transparency; this converter works with the colour part.

Text on Coloured Backgrounds

A colour's relative luminance shows how bright it looks to the eye, from 0 for black to 1 for white. Green light looks much brighter than blue, so the calculation weights green most heavily. Comparing luminance with white and with black shows which gives more readable text. Many designs put white text on medium blues and greens that are actually more readable with black text; the contrast ratio calculator checks this against accessibility standards.

Colours in Print

The CMYK figures here are a simple mathematical conversion. Real printing uses colour profiles that depend on the printer, inks and paper, so the same CMYK values can look different from one print shop to another. For important print work, ask for the printer's profile and check a physical proof.

Colour Names in CSS

Web browsers understand 148 named colours, such as dodgerblue, tomato, rebeccapurple and slategray, which map to exact hex values: dodgerblue is #1E90FF. Named colours are handy for quick prototypes, but most design systems use hex or HSL values for precise control. Modern CSS also supports newer colour spaces such as OKLCH, which spread colours more evenly for the human eye and are useful for building consistent palettes.

Building a Palette From One Colour

HSL makes it easy to build a set of related colours. Keep the hue and saturation, and change the lightness in steps — for example 95%, 85%, 70%, 56% and 40% — to create light backgrounds, borders, the main colour and dark text shades that all belong together. Rotating the hue by 180 degrees gives the complementary colour, and by 120 degrees gives a triadic scheme.

Colour Blindness

About one in twelve men and one in two hundred women have some form of colour vision deficiency, most often difficulty telling red from green. When choosing colours for charts and status messages, check that they differ in lightness as well as hue, so they remain distinguishable for everyone.

Transparency

Colours can also carry an alpha value for transparency, written as rgba(30, 144, 255, 0.5) or an eight-digit hex code such as #1E90FF80. Semi-transparent colours blend with whatever is behind them, so their final appearance, and their contrast with text, depends on the background they sit on as well as their own values.

Understanding Your Result

HEX gives the colour as a six-digit hex code.

RGB gives the red, green and blue values.

HSL gives hue, saturation and lightness.

HSV / HSB gives hue, saturation and value.

CMYK gives an approximate ink mix for print.

Text colour shows whether white or black text reads better, with the contrast.

When Should You Use This Calculator?

Web design and CSS.

Matching brand colours across tools.

Creating shades of a colour with HSL.

Preparing artwork for print.

Choosing text colours for buttons and banners.

Common Mistakes

Mixing up HSL and HSV.

Expecting printed colours to match the screen exactly.

Using three-digit hex for colours that cannot be shortened.

Forgetting the # sign in CSS.

Putting white text on light or medium colours.

Frequently Asked Questions

How do I convert HEX to RGB?

Split the six hex digits into three pairs and convert each from base 16. #1E90FF becomes 1E, 90 and FF, which are 30, 144 and 255, so the colour is rgb(30, 144, 255), a bright blue called dodger blue.

How do I convert RGB to HSL?

Scale each value to between 0 and 1, then lightness is the average of the largest and smallest, saturation depends on their difference, and hue on which channel is largest. rgb(30, 144, 255) is hsl(210, 100%, 56%).

What is the difference between HSL and HSV?

Both use hue, but HSL's lightness runs from black through the pure colour to white, while HSV's value runs from black to the pure colour. The same blue is hsl(210, 100%, 56%) and hsv(210, 88%, 100%).

How do I convert RGB to CMYK?

Black is 1 minus the largest RGB value as a fraction, and each ink is (1 − colour − black) ÷ (1 − black). Dodger blue is roughly cmyk(88%, 44%, 0%, 0%). Printers use colour profiles, so use proofs for accurate print colour.

What does a three-digit hex code mean?

It is shorthand where each digit is doubled: #1EF means #11EEFF and #FFF means #FFFFFF, white. Only colours whose three pairs each repeat the same digit can be written in this shorter form.

Should I use white or black text on a colour?

Use whichever gives the higher contrast. Dodger blue gives about 6.49:1 with black text but only 3.24:1 with white, so black text is easier to read on it, despite many designs using white.

Last reviewed September 28, 2026 by the CalculatorPeak editorial team.