Free Color Picker & Converter

Convert HEX, RGB, and HSL instantly. Check WCAG contrast and generate color harmonies.

#
or enter HEX, then press Enter / Tab
HEX
#F0B90B
RGB
rgb(240, 185, 11)
HSL
hsl(45, 93%, 49%)

Contrast vs White and Black
vs White (#FFFFFF)
—
vs Black (#000000)
—

Two-Color Contrast Checker
#
#
Contrast ratio
—

Normal text (16px): the quick brown fox jumps over the lazy dog.

Large text (24px)

ButtonIcon and border use the text color

Color Harmonies
Complementary
Triadic
Analogous
Split-Complementary
Advertisement

How to Use This Color Picker

This tool gives you two ways to choose a color. Click the large colored square to open your browser's native color picker — a full visual selector where you can sample any hue, saturation, and brightness. Alternatively, type a 6-digit HEX code directly into the text field (without the # symbol) and press Enter or Tab. As soon as you choose or enter a color, all three format outputs — HEX, RGB, and HSL — update instantly. Click any Copy button to copy that value to your clipboard. Below the conversions you'll find your color's WCAG contrast ratio against white and black, a two-color contrast checker for any text and background pair, and four color harmony palettes. Click any harmony swatch to set that color as your active color and recalculate everything.

HEX, RGB, and HSL — Understanding Color Formats

The three most common CSS color formats each have a different purpose. HEX (#RRGGBB) is a compact 6-character representation where each pair of digits is a hexadecimal value from 00 to FF representing the red, green, and blue channels. It's the most common format in design tools and CSS stylesheets because it's concise and copy-paste friendly. RGB (Red, Green, Blue) expresses the same information as three decimal values from 0 to 255. This format is intuitive for anyone who has worked with digital color before and is directly compatible with CSS's rgb() function. HSL (Hue, Saturation, Lightness) is arguably the most designer-friendly format: hue is a degree on the color wheel (0–360), saturation is a percentage measuring color intensity, and lightness is a percentage from black (0%) to white (100%). The major advantage of HSL is that you can programmatically lighten or darken a color just by adjusting the lightness value, without touching the hue at all — making it powerful for building themeable design systems.

WCAG Contrast Ratios for Accessible Design

The Web Content Accessibility Guidelines (WCAG) set minimum contrast ratio requirements between text and its background to ensure readability for users with low vision, color blindness, or who work in bright environments. The standard AA level requires a contrast ratio of at least 4.5:1 for normal-sized text (under 18pt regular or 14pt bold) and 3:1 for large text. The stricter AAA level requires 7:1 for normal text. Contrast ratio is calculated from relative luminance: ratio = (L1 + 0.05) ÷ (L2 + 0.05), where L1 is the luminance of the lighter color and L2 the darker, giving values from 1:1 (identical) to 21:1 (black on white). Each sRGB channel is first converted to linear light, then weighted 0.2126 for red, 0.7152 for green, and 0.0722 for blue, which is why greens and yellows look so much brighter than blues of the same numeric value. The first contrast panel compares your picked color with pure white (#FFFFFF) and pure black (#000000), showing at a glance whether it works as text on a white background or on a black one. The two-color checker below it compares any text color with any background color. For example, a bright yellow like #F0B90B scores about 11.6:1 against black but only about 1.8:1 against white, so it works as text on a dark background and fails AA on white — this checker tells you that immediately without any manual calculation.

Checking a Text and Background Pair

Real interfaces rarely put text on pure white or pure black, so the two-color checker takes any foreground (text) color and any background color. Type a HEX value (3 or 6 digits), use the swatches, or click Use picked color to copy the color from the picker above. Swap exchanges the two colors, and the ratio doesn't change, because contrast depends only on which color is lighter. The preview shows 16px body text, 24px large text, and an outlined button and icon drawn in the foreground color. The ratio is checked against five WCAG 2.2 thresholds:

  • AA normal text: 4.5:1 (Success Criterion 1.4.3).
  • AA large text: 3:1. Large means at least 18 point, about 24px, or 14 point bold, about 18.66px.
  • AAA normal text: 7:1 (Success Criterion 1.4.6).
  • AAA large text: 4.5:1.
  • UI components and graphics: 3:1 (Success Criterion 1.4.11), for icons, input borders, focus indicators and chart lines that people need in order to understand or use the page.

WCAG doesn't allow rounding up, so a ratio of 4.499:1 fails the 4.5:1 level. This tool truncates the displayed value instead of rounding it.

The checker starts with a common real-world case: medium grey text #848E9C on a white background. Its relative luminance is about 0.267, so the ratio is (1 + 0.05) ÷ (0.267 + 0.05) = 3.31:1. That passes for large text and for UI components, but fails AA for normal body text. When a pair fails, the suggestion panel searches for the nearest color that passes. It keeps the hue and saturation and moves only the HSL lightness, in 0.1-point steps, until the ratio reaches the level you choose. For this grey on white, the nearest AA color is #6C7787 at 4.53:1, only 8.8 lightness points darker, and the nearest AAA color is #515965 at 7.07:1. The panel also offers to adjust the background instead. If no lightness of that hue can reach the target, for example 7:1 against a mid-grey, it says so, and you'll need a darker or lighter partner color.

Color Harmonies in UI Design

Color theory defines several relationships between colors that tend to be visually pleasing. Complementary colors sit directly opposite each other on the color wheel (180° apart) and create strong contrast — useful for call-to-action buttons and visual highlights. Triadic harmonies use three colors evenly spaced at 120° apart, creating vibrant, energetic palettes often used in bold editorial and brand design. Analogous colors are adjacent on the wheel (here shown at ±30° and ±60°), producing natural, low-tension palettes that feel calm and cohesive — a favorite for background and UI surface color schemes. Split-complementary uses your base color plus the two colors flanking its direct complement (at 150° and 210°), which achieves high contrast without the stark tension of a direct complement.

Advertisement

Choosing Colors for Dark and Light Backgrounds

One of the most common design mistakes is choosing a color in isolation without testing it against the backgrounds it will actually appear on. Bright yellows, light greens, and pastels that look vivid and attractive on a white design mockup can become completely illegible as text. Pure yellow (#FFFF00), which pops beautifully on a dark navy background, has a contrast ratio of only 1.07:1 against white — barely distinguishable from the page itself. Use the contrast checker in this tool as a first-pass filter: if your color passes 4.5:1 against white, it's safe for body text on white backgrounds. If it passes 4.5:1 against black, it works as text on dark backgrounds. When your background isn't pure white or black, such as a tinted card, a dark-mode surface or a brand color, test the actual pair in the two-color checker. When neither passes, consider using the color for decorative purposes only (borders, icons, backgrounds), and pair it with a high-contrast foreground color for any text content.

Color in Web Development — CSS Color Functions

Modern CSS supports several color notations. The hex format (#RRGGBB, and the shorthand #RGB) remains the most common and is supported in all browsers. The rgb() and rgba() functions let you express colors with optional transparency: rgba(240, 185, 11, 0.5) gives you 50% transparent yellow. The hsl() and hsla() functions accept the same hue-saturation-lightness model shown in this tool, making it easy to create color variants programmatically — for example, you can define a brand color as hsl(45, 93%, 49%) and then generate a hover state at hsl(45, 93%, 40%) simply by reducing the lightness. Modern CSS also lets you add an alpha value directly inside rgb() and hsl() (for example, rgb(240 185 11 / 50%)), so the separate rgba() and hsla() names are now just legacy aliases. Two newer functions are supported in all current major browsers: color-mix() blends two colors directly in CSS, and oklch() uses the OKLCH color space, which is designed to be perceptually uniform, so changing its lightness value looks far more consistent across hues than changing HSL lightness does. HSL is still the easiest model to reason about, but because equal HSL lightness values can look very different in brightness (compare pure yellow and pure blue at 50%), always confirm contrast with a checker like this one.

Frequently Asked Questions

How do I convert HEX to RGB?

To convert a HEX color to RGB, split the 6-digit hex value into three 2-digit pairs representing red, green, and blue channels, then convert each pair from hexadecimal to decimal. For example, #F0B90B splits into F0 (red = 240), B9 (green = 185), 0B (blue = 11), giving RGB(240, 185, 11). This color picker does the conversion instantly as you type or pick a color.

What is the difference between HEX, RGB, and HSL color formats?

HEX (#RRGGBB) is a compact 6-character notation for colors, widely used in CSS and HTML. RGB (red, green, blue) expresses color as three values from 0–255 for each channel. HSL (hue, saturation, lightness) represents color using hue as a degree on the color wheel (0–360), saturation as a percentage (0–100%), and lightness as a percentage (0–100%). HSL is often more intuitive for designers because adjusting lightness or saturation is straightforward without changing the hue.

What is WCAG color contrast and why does it matter?

WCAG (Web Content Accessibility Guidelines) defines contrast ratio standards for text readability. A contrast ratio of 4.5:1 or higher passes AA for normal text, and 3:1 passes AA for large text (18pt+ or 14pt bold). A ratio of 7:1 passes AAA. Low contrast text is difficult to read for users with low vision or in bright environments. This tool shows your chosen color's contrast against pure black (#000000) and pure white (#FFFFFF), and its two-color checker tests any text color against any background color.

How do I check the contrast between two colors?

Enter the text color and the background color in the two-color contrast checker. It calculates the WCAG contrast ratio from the relative luminance of each color, shows pass or fail for AA and AAA normal and large text and for UI components, and previews the pair. If the pair fails, it suggests the nearest text or background color, with the same hue and saturation, that passes the level you choose.

What contrast ratio do buttons, icons and form borders need?

WCAG 2.2 Success Criterion 1.4.11 (Non-text Contrast) requires at least 3:1 between the visual parts of user interface components and graphics, such as icons, input borders and focus indicators, and the colors next to them. Text inside a button still follows the text rules: 4.5:1 for normal text and 3:1 for large text at level AA.

What are color harmonies?

Color harmonies are color combinations derived from the relationship between colors on the color wheel. Complementary colors sit directly opposite each other (180° apart) and create high contrast. Analogous colors are adjacent on the wheel (30° apart) and create harmonious, low-contrast palettes. Triadic colors are evenly spaced at 120° apart and create vibrant, balanced palettes. Split-complementary uses a base color and the two colors adjacent to its complement, offering contrast without the tension of a direct complement.

Sources: W3C: Understanding WCAG 2.2 Success Criterion 1.4.3 Contrast (Minimum); SC 1.4.6 Contrast (Enhanced); SC 1.4.11 Non-text Contrast; WCAG 2.2: relative luminance and contrast ratio definitions; MDN: oklch().

Advertisement

Related Articles

Expert guides and educational resources to help you master the math.