User Rating 0.0
Total Usage 0 times
Category CSS Tools
#
%
Presets
History
CSS Output
Is this tool helpful?

Your feedback helps us improve.

About

Every color displayed on screen resolves to a numeric triplet of red, green, and blue channel intensities in the range 0 - 255. Hexadecimal notation compresses this triplet into a six-character string prefixed with #, where each pair encodes one channel in base-16. A miscoded hex value in CSS or SVG silently fails to render, defaulting to black or inherited color and breaking visual hierarchy without throwing an error. This tool parses any hex input, validates it against the 16,777,216 possible sRGB values, and converts it to RGB, HSL, and CMYK simultaneously. It also computes WCAG 2.1 relative luminance and contrast ratios against white and black backgrounds so you can verify accessibility compliance before shipping.

hex color color picker hex to rgb color converter hex numbers css color color codes

Formulas

A hex color string #RRGGBB encodes three channel values. Each two-character pair is a base-16 integer converted to decimal:

R = 16 × R1 + R0

where R1 is the high nibble and R0 is the low nibble, both in range 0 - 15. The same applies to G and B channels.

RGB to HSL conversion normalizes channels to 0 - 1, then computes:

L = Cmax + Cmin2
S = Δ1 |2L 1|

where Δ = Cmax Cmin. Hue H depends on which channel is Cmax, computed as a 60° sector offset.

WCAG 2.1 relative luminance uses linearized sRGB:

L = 0.2126Rlin + 0.7152Glin + 0.0722Blin

where each linear channel Clin is obtained by applying the sRGB transfer function: if Csrgb 0.04045, then Clin = Csrgb12.92, otherwise Clin = ((Csrgb + 0.055) ÷ 1.055)2.4. Contrast ratio = L1 + 0.05L2 + 0.05 where L1 is the lighter luminance.

Reference Data

Color NameHex CodeRGBHSLUsage Context
White#FFFFFF255255255, 0%, 100%Backgrounds, whitespace
Black#000000000, 0%, 0%Text, borders
Red#FF000025500, 100%, 50%Errors, alerts
Green#00FF0002550120°, 100%, 50%Success states
Blue#0000FF00255240°, 100%, 50%Links, primary actions
Coral#FF7F502551278016°, 100%, 66%CTAs, warm accents
Teal#0080800128128180°, 100%, 25%Professional themes
Gold#FFD700255215051°, 100%, 50%Highlights, premium
Slate Gray#708090112128144210°, 13%, 50%Secondary text
Indigo#4B0082750130275°, 100%, 25%Creative branding
Tomato#FF63472559971, 100%, 64%Warning, attention
Medium Purple#9370DB147112219260°, 60%, 65%Creative UI
Dark Cyan#008B8B0139139180°, 100%, 27%Medical, science UI
Chocolate#D2691E2101053025°, 75%, 47%Earth tones, organic
Steel Blue#4682B470130180207°, 44%, 49%Corporate, dashboards
Lime Green#32CD325020550120°, 61%, 50%Eco, nature themes
Hot Pink#FF69B4255105180330°, 100%, 71%Fashion, playful UI
Midnight Blue#1919702525112240°, 64%, 27%Dark themes, headers
Light Salmon#FFA07A25516012217°, 100%, 74%Soft CTA, food apps
Rebecca Purple#66339910251153270°, 50%, 40%CSS named color (2014)

Frequently Asked Questions

A 3-digit hex code like #F0A is shorthand where each digit is doubled: #FF00AA. The 6-digit form provides full precision with 16,777,216 possible colors. Some tools also support 8-digit hex (#RRGGBBAA) where the last two characters encode alpha transparency from 00 (fully transparent) to FF (fully opaque).
Hex codes encode sRGB channel values. Each pair maps linearly to 0-255 integer intensity per channel. This is gamma-encoded sRGB, not linear light. Calculations requiring perceptual accuracy (luminance, color difference) must first linearize these values using the sRGB transfer function with the 0.04045 threshold and 2.4 gamma exponent.
Display color depends on the monitor's color profile (ICC), backlight technology, and gamma calibration. A hex value #6C8EEF defines an sRGB coordinate, but an uncalibrated wide-gamut display may render it more saturated. Use hardware colorimeters and ICC profiles for cross-device consistency. The hex number itself is correct; the rendering pipeline introduces variance.
WCAG 2.1 Level AA requires a minimum contrast ratio of 4.5:1 for normal text (below 18pt or 14pt bold) and 3:1 for large text. Level AAA requires 7:1 for normal text and 4.5:1 for large text. These ratios are computed from relative luminance values derived from linearized sRGB channels, not from perceived brightness alone.
RGB-to-CMYK conversion computes the Key (black) channel as K = 1 − max(R', G', B') where R' = R/255. Then C = (1 − R' − K) / (1 − K), and similarly for M and Y. This is a mathematical approximation. Actual print CMYK depends on ink profiles, paper stock, and press calibration. For production work, use ICC color profiles and soft-proofing in dedicated prepress software.
No. Hex notation is limited to the sRGB gamut: 256 levels per channel, totaling 16,777,216 colors. Display P3, Adobe RGB, and Rec. 2020 gamuts exceed sRGB. CSS now supports these via the color() function (e.g., color(display-p3 0.42 0.56 0.94)). Hex codes cannot encode these wider-gamut values.