Colour converter
Type a colour in any format, or pick one, to get it in every other format with accessibility contrast checks.
Contrast with text
Tints and shades
This free colour code converter works in your browser. All inputs and calculations run locally on your device without server uploads; details on browser processing and storage are set out in the privacy policy.
The colour formats
| Format | Example | Used in |
|---|---|---|
| HEX | #0B5D45 | Web design, CSS, design tools |
| RGB | rgb(11 93 69) | CSS and screens: red, green and blue light from 0 to 255 |
| HSL | hsl(162 79% 20%) | CSS; easy to make lighter or darker by changing L |
| HSV / HSB | 162°, 88%, 36% | Photoshop and most colour pickers |
| CMYK | 88%, 0%, 26%, 64% | Printing |
CMYK here is a simple conversion. Printers use colour profiles, so check important print colours with your printer.
Contrast and accessibility
The Web Content Accessibility Guidelines (WCAG) ask for a contrast ratio of at least 4.5:1 between normal text and its background (AA), or 7:1 for AAA. Large text, 24 px or 18.5 px bold, needs 3:1. The table shows how your colour does against white and black.
Worked example: Converting brand blue #2563EB to RGB, HSL, CMYK, and checking WCAG contrast
Take the primary interface blue #2563EB and trace how each color model represents it:
- HEX to RGB (base 16 to base 10): Split
2563EBinto three pairs: Red =0x25 = (2 × 16) + 5 = 37; Green =0x63 = (6 × 16) + 3 = 99; Blue =0xEB = (14 × 16) + 11 = 235→rgb(37, 99, 235). - RGB to HSL: Normalize RGB to
0..1(R'=0.145, G'=0.388, B'=0.922). Max isB'=0.922, Min isR'=0.145, so LightnessL = (0.922 + 0.145) / 2 = 0.533(53%), SaturationS =83%, and HueH =221° →hsl(221, 83%, 53%). - WCAG 2.1 relative luminance and contrast: Relative luminance of
#2563EBisL = 0.122. Against pure white (#FFFFFF,L = 1.000), contrast is(1.000 + 0.05) ÷ (0.122 + 0.05) =6.10 : 1 (passes WCAG AA normal text≥ 4.5:1and AA large text≥ 3.0:1), whereas against black (#000000) it is only 3.44 : 1 (fails normal text).
Limits and what this tool cannot do
- Mathematical CMYK formula vs ICC press profiles: The CMYK output (
cmyk(84%, 58%, 0%, 8%)) uses the device-independent mathematical RGB-to-CMYK formula (K = 1 − max(R',G',B')). Commercial offset printing requires a specific ICC color profile (such as US Web Coated SWOP v2 or FOGRA39) to account for ink dot gain and total area coverage limits. - sRGB 8-bit gamut only (no OKLCH, Lab, or Display P3): This tool converts within the standard 8-bit sRGB color space (
#000000to#FFFFFF) without alpha opacity (#RRGGBBAA). - Does not pick colors from external screen windows: Use your browser's DevTools eyedropper to sample a pixel from another page, then paste the HEX code here.
Questions
Which formats can I type?
HEX (3, 4, 6 or 8 digits), rgb() and rgba(), hsl() and hsla(), and the 148 CSS colour names such as teal or rebeccapurple.
How do I make a colour lighter?
Click a tint in the row above, or lower the L value in HSL.
Does it support transparency?
Yes. 8-digit HEX and rgba/hsla keep the alpha value.
What does a 3-digit shorthand HEX code like #F0A mean?
In CSS 3-digit HEX shorthand, each digit is duplicated to form a 6-digit code: #F0A expands to #FF00AA (rgb(255, 0, 170)).
What contrast ratio do I need to pass WCAG 2.1 accessibility checks?
WCAG 2.1 Level AA requires at least **4.5 : 1** for normal body text (under 18pt, or under 14pt bold) and **3.0 : 1** for large headings and UI component borders. Level AAA requires **7.0 : 1** for normal text.
Why is HSL easier for building UI themes than HEX or RGB?
In HSL (Hue, Saturation, Lightness), you can keep the Hue (221°) and Saturation (83%) fixed while varying only Lightness from 95% (soft badge background) down to 20% (dark text) to create a harmonious 10-step color palette.