Copied!
HEX · RGB · HSL · Palette

Color Picker

Pick any color and instantly get HEX, RGB, HSL, and HSV values. Generate tints and shades, check contrast ratios for accessibility, and copy any value with one click.

Last updated · Contrast thresholds checked against W3C WCAG 2.2

HEX, RGB, HSL, HSV
Tints & Shades
Contrast Ratio (WCAG)
Click to Copy
Our networkfavorit5The 5 worth buying.Top fives, comparisons and what reviewers say.See the top 5s
#7C3AED
Purple
HEX copy
#7C3AED
RGB copy
rgb(124, 58, 237)
HSL copy
hsl(262, 83%, 58%)
HSV copy
hsv(262, 76%, 93%)
CMYK copy
cmyk(48, 76, 0, 7)
CSS Var copy
--color: #7C3AED
Tints (lighter)
Shades (darker)
Contrast Ratio (WCAG)
—
— —
on white
—
— —
on black

Color Formats Explained

Contrast ratio compares the relative luminance of two colors: (L1 + 0.05) divided by (L2 + 0.05), where L1 is the lighter color. WCAG AA requires at least 4.5:1 for normal text and 3:1 for large text. Pick a color above to get its HEX, RGB, HSL, HSV and CMYK values, tints and shades, and its contrast ratio against white and black.

Every color on screen can be represented in multiple formats. HEX (#RRGGBB) is a base-16 encoding of RGB values: the standard for web development and CSS. RGB (Red, Green, Blue) represents colors as three integers from 0 to 255, matching how screens physically display color. HSL (Hue, Saturation, Lightness) is more intuitive for humans: hue is the color angle (0 to 360°), saturation is vividness, lightness is brightness. HSV/HSB uses brightness instead of lightness.

HEX Color Codes

#RRGGBB uses pairs of hex digits (00 to FF = 0 to 255) for red, green, and blue. #FF0000 = pure red. #000000 = black. #FFFFFF = white. Shorthand: #RGB when each pair is identical (#FFF = #FFFFFF). HEX is the universal CSS standard.

WCAG Contrast

WCAG 2.1 and 2.2 require a minimum 4.5:1 contrast ratio for normal text (AA), 7:1 for enhanced (AAA), and 3:1 for large text. Contrast ratio is calculated from relative luminance values. Good contrast is essential for accessibility and readability for users with visual impairments.

Tints and Shades

A tint is a color mixed with white (lighter). A shade is a color mixed with black (darker). A tone adds gray. Design systems use scales of tints and shades (50, 100, 200...900) to create consistent, accessible color hierarchies like Tailwind CSS's color palette.

CSS Custom Properties

CSS variables (--color-name: #value) let you define colors once and reuse them throughout a stylesheet. Using CSS variables for colors makes it trivial to implement dark mode and theme switching without duplicating selectors.

How the WCAG Contrast Ratio Is Calculated

  1. Scale each channel to 0 to 1. Divide R, G and B by 255.
  2. Linearize. If a value c is 0.04045 or less, use c ÷ 12.92; otherwise use ((c + 0.055) ÷ 1.055)2.4. Older WCAG text says 0.03928 instead of 0.04045; for 8-bit colors both give identical results.
  3. Relative luminance. L = 0.2126 R + 0.7152 G + 0.0722 B, using the linearized values. Green weighs most because the eye is most sensitive to it. Black is 0, white is 1.
  4. Contrast ratio. (L1 + 0.05) ÷ (L2 + 0.05), with L1 the lighter color. The result runs from 1:1 (same color) to 21:1 (black on white).

Worked example: #7C3AED on white. The channels are 124, 58 and 237, which scale to 0.4863, 0.2275 and 0.9294 and linearize to 0.2016, 0.0423 and 0.8469. Luminance is 0.2126 × 0.2016 + 0.7152 × 0.0423 + 0.0722 × 0.8469 = 0.1343. Against white: (1 + 0.05) ÷ (0.1343 + 0.05) = 5.70:1, which passes AA for all text but not AAA (7:1).

WCAG Contrast Thresholds

WhatLevel AALevel AAAWCAG rule
Normal text4.5:17:11.4.3 and 1.4.6
Large text (24 px, or 18.66 px bold)3:14.5:11.4.3 and 1.4.6
Icons, input borders, focus rings, chart lines3:1no higher level1.4.11
Logos and disabled controlsno requirementno requirementexempt

Large text means at least 18 point (24 CSS pixels) regular, or 14 point (about 18.66 CSS pixels) bold. The ratio is not rounded up: 4.49:1 fails a 4.5:1 requirement.

Contrast of Common Colors on White and Black

Computed with the formula above. "Best text" is whichever of white or black gives the higher ratio, which is what the preview swatch on this page now uses.

ColorOn whiteOn blackBest textNormal text AA
#333333 dark gray12.63:11.66:1WhitePasses (with white)
#595959 gray7.00:13.00:1WhitePasses, also AAA
#767676 gray4.54:14.62:1BlackPasses with either
#777777 gray4.48:14.69:1BlackFails on white
#6B7280 slate gray4.83:14.34:1WhitePasses on white only
#7C3AED violet5.70:13.69:1WhitePasses on white
#2563EB blue5.17:14.06:1WhitePasses on white
#3B82F6 light blue3.68:15.71:1BlackLarge text only on white
#DC2626 red4.83:14.35:1WhitePasses on white
#EF4444 light red3.76:15.58:1BlackLarge text only on white
#16A34A green3.30:16.37:1BlackLarge text only on white
#F97316 orange2.80:17.49:1BlackFails on white
#EAB308 yellow1.92:110.95:1BlackFails on white

The pattern to remember: bright greens, oranges and yellows almost never work as text on white. Use a darker shade from the Shades row above, or put black text on them instead.

Converting Between Color Formats

All formats describe the same sRGB color. Taking #7C3AED as the example:

  • HEX to RGB: 7C = 7 × 16 + 12 = 124, 3A = 58, ED = 237, so rgb(124, 58, 237).
  • RGB to HSL: max 237, min 58. Lightness is (max + min) ÷ 2 ÷ 255 = 57.8%. Saturation is (max − min) ÷ (510 − max − min) = 179 ÷ 215 = 83.3%. Blue is the largest channel, so hue = 60 × ((R − G) ÷ (max − min) + 4) = 262.1°. Result: hsl(262, 83%, 58%).
  • RGB to HSV: value is max ÷ 255 = 92.9%, saturation (max − min) ÷ max = 75.5%, same hue: hsv(262, 76%, 93%).
  • RGB to CMYK: K = 1 − max ÷ 255 = 7.1%, then C = (1 − R/255 − K) ÷ (1 − K) = 47.7%, M = 75.5%, Y = 0%: cmyk(48, 76, 0, 7). This is the simple formula; print shops convert with an ICC profile for their press, so expect their numbers to differ.
Method and sources. Contrast ratio and relative luminance as defined in W3C Web Content Accessibility Guidelines (WCAG) 2.2, success criteria 1.4.3, 1.4.6 and 1.4.11, using the sRGB transfer function (IEC 61966-2-1). HSL and HSV conversions follow the formulas in the CSS Color Module Level 4. Every ratio and value above was computed in node with the same code this page runs. The tool works entirely in your browser; colors you pick are not sent anywhere.

Frequently Asked Questions

Split the HEX code into three pairs: #RRGGBB. Convert each pair from base-16 to base-10. Example: #FF6B35 → R=FF=255, G=6B=107, B=35=53 → rgb(255, 107, 53). In JavaScript: parseInt('FF',16)=255. Alternatively, this tool does all conversions instantly: just enter the HEX value in the picker.

HSL stands for Hue, Saturation, Lightness. Hue is the color angle on the wheel (0°=red, 120°=green, 240°=blue). Saturation is vividness (0%=gray, 100%=full color). Lightness is brightness (0%=black, 50%=normal, 100%=white). HSL is more intuitive than RGB for design work: to make a color lighter, just increase L. To desaturate, decrease S. This makes creating color variations and tints far easier than manipulating RGB values.

WCAG 2.1 and 2.2 define the same standards: AA (minimum): 4.5:1 for normal text, 3:1 for large text (18pt+ or 14pt+ bold). AAA (enhanced): 7:1 for normal text, 4.5:1 for large text. Most legal accessibility requirements (ADA, EN 301 549) follow AA. Black text on white = 21:1. Dark gray #333 on white ≈ 12.6:1. Medium gray #767676 on white is 4.54:1, the lightest gray that passes AA; #777777 is 4.48:1 and fails. Always test your text/background combinations.

Both have Hue and Saturation, but differ in the third component. HSL Lightness: 0%=black, 50%=pure color, 100%=white. HSV Value (Brightness): 0%=black, 100%=pure color (white is S=0, V=100%). HSL is more common in CSS and web design. HSV is the standard in most design software color pickers (Photoshop, Figma and others). Both represent the same colors: they're just different mathematical models.

CSS custom properties (variables) are defined with double-dash prefix: --color-primary: #7c3aed; inside a selector (usually :root for global scope). Reference them with var(): color: var(--color-primary);. They cascade and inherit like other CSS properties. Modern design systems define an entire color scale as CSS variables, enabling instant dark mode: just redefine the variables inside @media (prefers-color-scheme: dark) or a .dark class.

CMYK (Cyan, Magenta, Yellow, Key/Black) is the color model used in color printing. Unlike RGB (additive, for screens), CMYK is subtractive: mixing inks absorbs light. C+M+Y theoretically = black, but pure black (K) is added for sharper text and to save ink. RGB and CMYK have different color gamuts: some vibrant RGB colors cannot be reproduced in print. This is why designs created on screen can look different when printed.

A tint is the result of mixing a color with white: it increases lightness while reducing saturation. A shade is mixing with black: it decreases lightness. A tone adds gray. Design systems (like Tailwind, Material Design) use numbered scales: 50 (lightest tint) through 950 (darkest shade). The 500 is usually the "base" color. Using consistent tint/shade scales ensures visual harmony across backgrounds, borders, hover states, and text.

Use this tool's contrast checker: pick your background color, then check the contrast ratio against black and white. For the text color that passes, use it. General rules: white text works well on dark, saturated colors (check ratio). Black text is usually best on light backgrounds. For mid-range colors (medium blue, green), calculate the ratio for both: sometimes neither pure black nor pure white passes AAA. Use the darkest shade that passes AA for regular text, or increase font size to qualify for the lower large-text threshold (3:1).

oklch is a modern perceptual color space gaining adoption in CSS (supported in all major browsers since 2023). It uses Lightness, Chroma (vividness), and Hue. Unlike HSL, oklch is perceptually uniform, two colors with the same L value actually look equally bright to human eyes. This makes oklch ideal for generating accessible color scales: colors at the same lightness look equally readable regardless of hue. CSS 4 color functions like oklch(70% 0.15 263) are becoming the modern alternative to HEX and HSL.

Start with a primary color that represents your brand. Then build: (1) Neutrals, grays for text, backgrounds, borders; (2) Semantic colors, success (green), warning (yellow), error (red), info (blue); (3) Tints/shades of your primary for hover states, backgrounds, accents. Keep it minimal: 3 to 5 hues maximum. Use HSL to create harmonious variations. Always check contrast for text/background pairs. Tools like Coolors, Adobe Color, and Tailwind's color palette are excellent starting points.

Text that is at least 18 point (24 CSS pixels) in regular weight, or 14 point (about 18.66 CSS pixels) in bold. Large text only needs 3:1 for AA and 4.5:1 for AAA, because bigger letters stay readable at lower contrast. Normal body text at 16 px needs 4.5:1.

WCAG 2.1 and 2.2 success criterion 1.4.11 asks for at least 3:1 between a control or meaningful graphic and the colors next to it. That covers input borders, checkbox outlines, focus indicators, icons without text and the lines in a chart. The text inside a button still needs 4.5:1 against the button color.