Color Picker

Hex, RGB and HSL for any color.

#3B82F6
HEX
59, 130, 246
RGB
217, 91%, 60%
HSL

How to Use the Color Picker

  1. **Pick visually or enter a code** — Click the color swatch to open the visual picker and drag to your desired color, OR type a known value directly into the HEX, RGB, or HSL input field.
  2. **Choose your source format** — Select which format you're converting *from* (e.g., paste a HEX code like #3A86FF from a brand guide).
  3. **Read the converted outputs** — All equivalent codes (HEX, RGB, HSL, HSV) update instantly in their respective fields.
  4. **Preview the color swatch** — Check the large color preview panel to visually confirm the color looks correct before copying.
  5. **Copy your desired format** — Click the copy icon next to any field (HEX, RGB, HSL, or HSV) to copy that code to your clipboard for use in CSS, design tools, or documents.

Color Conversion Formulas

HEX = #RRGGBB | RGB→HSL: L=(Cmax+Cmin)/2, S=Δ/(1−|2L−1|), H=60°×f(R',G',B') | RGB→HSV: V=Cmax, S=Δ/Cmax

The core conversions link three major color models. All formulas below assume:

  • RGB values are integers in the range 0–255.
  • H (hue) is in degrees 0°–360°.
  • S (saturation) and L (lightness) or V (value) are percentages expressed as decimals 0–1.

HEX ↔ RGB

HEX is simply the two-digit hexadecimal representation of each 8-bit channel (0–255):

HEX = #RRGGBB  where RR = hex(R), GG = hex(G), BB = hex(B)

RGB → HSL

R' = R/255,  G' = G/255,  B' = B/255
Cmax = max(R', G', B'),  Cmin = min(R', G', B'),  Δ = Cmax − Cmin

L = (Cmax + Cmin) / 2

S = 0                          if Δ = 0
S = Δ / (1 − |2L − 1|)        if Δ ≠ 0

H = 60° × [(G'−B')/Δ mod 6]   if Cmax = R'
H = 60° × [(B'−R')/Δ + 2]     if Cmax = G'
H = 60° × [(R'−G')/Δ + 4]     if Cmax = B'
H = 0                          if Δ = 0

RGB → HSV

V = Cmax
S = 0          if Cmax = 0
S = Δ / Cmax   if Cmax ≠ 0
(H same formula as RGB → HSL)
  • R, G, B — Red, Green, Blue channel values — integers from 0 (none) to 255 (full intensity).
  • R', G', B' — Normalized channel values: each channel divided by 255, giving a decimal between 0 and 1.
  • Cmax — The largest of the three normalized channel values (R', G', B').
  • Cmin — The smallest of the three normalized channel values (R', G', B').
  • Δ (Delta) — The range of the normalized channels: Cmax − Cmin. A value of 0 means the color is achromatic (grey).
  • H — Hue — the angular position on the color wheel, measured in degrees from 0° to 360°.
  • S — Saturation — how vivid or pure the color is, as a decimal 0–1 (or 0%–100%).
  • L — Lightness (HSL model) — perceived brightness from pure black (0) to pure white (1), with 0.5 being the 'pure' hue.
  • V — Value (HSV model) — the maximum brightness of the color, equal to Cmax, ranging from 0 to 1.
  • HEX / #RRGGBB — Six-character hexadecimal string where each pair of characters (RR, GG, BB) is the base-16 representation of that channel (00–FF).

Worked Example: Converting a Vivid Blue

Starting color: HEX #3A86FF Expected RGB: R = 58, G = 134, B = 255
Step 1 – HEX to RGB:
  R = 0x3A = 58,  G = 0x86 = 134,  B = 0xFF = 255

Step 2 – Normalize:
  R' = 58/255 ≈ 0.2275
  G' = 134/255 ≈ 0.5255
  B' = 255/255 = 1.0000

Step 3 – Find Cmax, Cmin, Δ:
  Cmax = 1.0000 (B'),  Cmin = 0.2275 (R'),  Δ = 0.7725

Step 4 – Lightness (L):
  L = (1.0000 + 0.2275) / 2 = 0.6138  → 61.4%

Step 5 – Saturation (S):
  |2L − 1| = |2×0.6138 − 1| = 0.2275
  S = 0.7725 / (1 − 0.2275) = 0.7725 / 0.7725 = 1.0000  → 100%

Step 6 – Hue (H), Cmax = B':
  H = 60° × [(R'−G')/Δ + 4]
  H = 60° × [(0.2275 − 0.5255)/0.7725 + 4]
  H = 60° × [−0.3857 + 4]
  H = 60° × 3.6143 ≈ 216.9°  → 217°

Step 7 – HSV:
  V = Cmax = 1.0000  → 100%
  S_HSV = Δ / Cmax = 0.7725 / 1.0000 = 0.7725  → 77%

Result: HEX: #3A86FF RGB: rgb(58, 134, 255) HSL: hsl(217°, 100%, 61%) HSV: hsv(217°, 77%, 100%)

What Your Result Means

The color #3A86FF is a bright, saturated cornflower blue. Its HSL representation — hsl(217, 100%, 61%) — tells you it sits at hue 217° (solidly in the blue range), has maximum saturation (100%), and is slightly brighter than mid-tone at 61% lightness. Its HSV representation — hsv(217°, 77%, 100%) — shows the color reaches maximum brightness (V=100%) but the saturation is 77% rather than 100% because HSV measures how much white is mixed in relative to the peak brightness, which differs from HSL's definition.

Understanding Color Picker

Understanding Color Models

Why do multiple color models exist?

Different industries and applications describe color in ways that are most intuitive or technically convenient for their use case:

  • HEX is the standard for web/CSS. It is compact, human-readable, and directly maps to the 8-bit-per-channel RGB that monitors use.
  • RGB (Red, Green, Blue) is the native language of screens. It uses additive color mixing — combining full R, G, and B gives white; combining none gives black.
  • HSL (Hue, Saturation, Lightness) is human-intuitive. Designers prefer it because adjusting lightness or saturation independently is natural and predictable.
  • HSV / HSB (Hue, Saturation, Value/Brightness) is common in design software (Photoshop, Illustrator). "Value" represents the maximum intensity of light rather than a mid-tone lightness.
  • CMYK (Cyan, Magenta, Yellow, Black) is used in print. Screens use additive RGB; printers use subtractive CMYK.

HEX Notation Explained

A HEX color is a 6-character string prefixed with #. Each pair of characters is a base-16 (hexadecimal) number from 00 (0 decimal) to FF (255 decimal), representing the intensity of Red, Green, and Blue respectively. For example:

  • #FF0000 = pure red (R=255, G=0, B=0)
  • #000000 = black
  • #FFFFFF = white
  • Shorthand #RGB (3 characters) is valid in CSS when each pair is a repeated digit: #3AF expands to #33AAFF.

HSL vs. HSV: Key Difference

Both models use hue and saturation, but they differ in the third channel:

  • In HSL, L=50% with S=100% gives the purest version of a hue. L=0% is always black; L=100% is always white.
  • In HSV, V=100% with S=100% gives the purest hue. V=0% is always black, but V=100% with S=0% is white.

This means the same pure red (#FF0000) is HSL(0°, 100%, 50%) but HSV(0°, 100%, 100%).

Color Gamut and Web Safe Colors

Not all HEX colors display identically on every screen due to color gamut differences (sRGB vs. Display P3 vs. Adobe RGB). For most web use cases, sRGB (the default) covers all standard HEX codes. Web-safe colors — a legacy 216-color subset using only 00, 33, 66, 99, CC, FF per channel — are no longer a practical concern on modern displays but still appear in some style guides.

Common Mistakes

  • **Forgetting the # prefix in CSS** — HEX colors in CSS require the `#` symbol (e.g., `color: #3A86FF;`). Omitting it causes the style to be ignored silently.
  • **Mixing up HSL and HSV saturation** — The same color has different S values in HSL and HSV. Always check which model your tool or code is expecting before copy-pasting.
  • **Using 3-digit HEX when 6 digits are needed** — `#3AF` only works as shorthand if both digits of each channel are identical (`#33AAFF`). `#3A86FF` cannot be shortened.
  • **Confusing lightness (HSL) and brightness/value (HSV)** — A pure hue at HSL L=50% is NOT the same as HSV V=50% (which is a dark color). Don't swap these values between models.
  • **Assuming RGB percentages** — Some tools express RGB as 0%–100% rather than 0–255. `rgb(100%, 0%, 0%)` and `rgb(255, 0, 0)` are both pure red, but the formats are not interchangeable without conversion.
  • **Ignoring alpha (opacity)** — RGBA and HSLA include a fourth channel (0–1) for opacity. A color with alpha=0 is fully transparent and will be invisible even if the RGB values are correct.

Common Questions About Color Picker

How do I convert RGB to HEX manually?

Convert each channel (R, G, B) from decimal to hexadecimal separately, then concatenate them. For example: R=58 → 3A, G=134 → 86, B=255 → FF, giving #3A86FF. You can divide by 16 for the first digit and take the remainder for the second, using A–F for values 10–15.

What hue values correspond to which colors on the wheel?

Hue in degrees maps as follows: 0°/360° = Red, 30° = Orange, 60° = Yellow, 120° = Green, 180° = Cyan, 240° = Blue, 270° = Violet, 300° = Magenta. This applies to both HSL and HSV models.

How many colors can be represented in the HEX system?

With 3 channels each having 256 possible values (00–FF), there are 256³ = 16,777,216 possible HEX colors. This is commonly referred to as '16 million colors' and represents the full 24-bit color depth of standard RGB monitors.

What is the difference between HSV and HSB?

HSV and HSB are identical — 'Value' and 'Brightness' are two names for the same channel. Adobe Photoshop uses HSB; most programming libraries and color theory texts use HSV. The formulas and numeric results are the same.

How do I find the complementary color of a HEX code?

Convert the color to HSL, then add 180° to the hue (wrapping around at 360° if needed). Keep the same saturation and lightness. For example, the complement of hsl(217°, 100%, 61%) is hsl(37°, 100%, 61%) — a warm amber/orange.

Frequently Asked Questions

What is the difference between HEX and RGB color codes?

HEX and RGB represent the same color data in different notations. RGB uses three decimal integers — e.g., rgb(58, 134, 255) — while HEX encodes each channel as a two-digit base-16 number — e.g., #3A86FF. They are mathematically equivalent and convert directly to each other.

Can I use HSL colors directly in CSS?

Yes. Modern CSS fully supports HSL syntax: `color: hsl(217, 100%, 61%);`. You can also use HSLA for transparency: `color: hsla(217, 100%, 61%, 0.8);`. HSL is often preferred in CSS for theming because it's easy to adjust lightness or saturation programmatically.

What does the alpha channel do in RGBA or HSLA?

The alpha channel controls opacity. It ranges from 0 (fully transparent, invisible) to 1 (fully opaque). For example, `rgba(58, 134, 255, 0.5)` is the same blue at 50% transparency, which lets background content show through.

Why does my color look different on print vs. screen?

Screens use additive RGB color (light is emitted), while printers use subtractive CMYK (ink absorbs light). Vivid RGB colors — especially electric blues and greens — often cannot be reproduced exactly in CMYK print, resulting in a color shift. For print work, always verify your CMYK values.

Is HEX color case-sensitive?

No. HEX color codes are case-insensitive. `#3a86ff`, `#3A86FF`, and `#3A86ff` all refer to the same color. Most style guides recommend uppercase for consistency in codebases.

What is a color picker used for in web design?

A color picker lets designers and developers identify exact color codes for use in CSS, HTML, SVG, and design tools. It ensures brand color consistency, helps match colors from images or mockups, and allows exploration of color palettes before committing to a design.

Related Calculators

Sources

Only sources that have been reviewed are shown. Unverified citations are never published.

Spotted a calculation error?Report an Error