Skip to main content
ToolCube – All tools at one place.

HSL to HEX Converter

Enter hue, saturation and lightness to get the matching HEX code, ready to paste into CSS, HTML or a design tool.

  • HSL to HEX preselected
  • Every format with Copy
  • Contrast checker

Convert a color

Detected: HSL

RGB
HSL

All formats

  • HEX#ff6600
  • RGBrgb(255, 102, 0)
  • HSLhsl(24, 100%, 50%)
  • HSV / HSBhsv(24, 100%, 100%)
  • CMYKcmyk(0%, 60%, 100%, 0%)
  • Nameclosest: orangered
  • CSScolor: #ff6600;

CMYK values are an approximation for screen colors; printed colors depend on the printer profile.

Pick a color from an image

Upload a photo or screenshot (JPG, PNG, WebP, AVIF or iPhone HEIC), then click or tap any point to pick its color. The image stays on your device.

Want to recolor part of an image? Try Change Image Color.

Shades, tints and harmonies

Shades (darker)

  • #e85d00
  • #d15300
  • #b94a00
  • #a24100
  • #8b3800
  • #742e00
  • #5d2500
  • #461c00
  • #2e1300
  • #170900

Tints (lighter)

  • #ff7417
  • #ff822e
  • #ff9046
  • #ff9e5d
  • #ffac74
  • #ffb98b
  • #ffc7a2
  • #ffd5b9
  • #ffe3d1
  • #fff1e8

Harmonies

Complementary – Opposite on the color wheel (180°).

Analogous – Neighbours 30° either side.

Triadic – Three colors 120° apart.

Split-complementary – The two colors next to the complement (150° and 210°).

Tetradic (square) – Four colors 90° apart.

Contrast checker (WCAG)

  • Your color on white

    2.93:1

    Sample of your color as text on #ffffff: contrast 2.93:1.

    • AA normal: Fail
    • AA large: Fail
    • AAA normal: Fail
    • AAA large: Fail
  • Your color on black

    7.15:1

    Sample of your color as text on #000000: contrast 7.15:1.

    • AA normal: Pass
    • AA large: Pass
    • AAA normal: Pass
    • AAA large: Pass
  • Your color on #1e3a8a

    3.52:1

    Sample of your color as text on #1e3a8a: contrast 3.52:1.

    • AA normal: Fail
    • AA large: Pass
    • AAA normal: Fail
    • AAA large: Fail

Guide

How to convert HSL to HEX

  1. Chroma = (1 − |2 × L − 1|) × S, with S and L as fractions from 0 to 1.
  2. Divide the hue by 60 to find which sixth of the color wheel it is in, and work out a second value X = chroma × (1 − |(H ÷ 60) mod 2 − 1|).
  3. Assign chroma, X and 0 to red, green and blue depending on that sixth, then add L − chroma ÷ 2 to each.
  4. Multiply by 255, round, and write each value as two hex digits: hsl(24, 100%, 50%) is #ff6600.

From a design idea to a code

Many palettes start in HSL: a designer picks a hue and then lighter and darker steps. Websites, apps and brand guides, however, usually store the final colors as HEX codes. Converting turns each step into a code you can hand to developers or paste into a theme.

Because HEX has only 256 levels per channel, very small HSL changes can produce the same HEX code. If you nudge lightness by 0.1% and the HEX code does not change, the two colors are identical on screen.

Entering HSL values

Hue is an angle from 0 to 360 degrees; 360 is the same as 0 (red). Saturation and lightness are percentages from 0 to 100. You can write them with commas, hsl(24, 100%, 50%), or with spaces, hsl(24 100% 50%). Add a fourth value, or / 50%, for transparency.

At 0% lightness every hue is black, and at 100% every hue is white, so the hue and saturation do not matter there. At 0% saturation every color is a grey.

Checking HSL colors by eye

Because HSL numbers are easy to adjust, it is tempting to change them without looking. The preview and the contrast checker on this page show the result straight away. Colors with the same lightness value can look very different in brightness: yellow at 50% lightness appears much brighter than blue at 50%, which matters for readable text.

Use the contrast checker to confirm that a color generated from HSL still meets accessibility guidelines before you copy its HEX code.

HSL to HEX chart of common colors

HSL to HEX values for common colors
ColorHSLHEX
Blackhsl(0, 0%, 0%)#000000
Whitehsl(0, 0%, 100%)#ffffff
Redhsl(0, 100%, 50%)#ff0000
Limehsl(120, 100%, 50%)#00ff00
Bluehsl(240, 100%, 50%)#0000ff
Yellowhsl(60, 100%, 50%)#ffff00
Cyanhsl(180, 100%, 50%)#00ffff
Magentahsl(300, 100%, 50%)#ff00ff
Silverhsl(0, 0%, 75.3%)#c0c0c0
Grayhsl(0, 0%, 50.2%)#808080
Maroonhsl(0, 100%, 25.1%)#800000
Olivehsl(60, 100%, 25.1%)#808000
Greenhsl(120, 100%, 25.1%)#008000
Purplehsl(300, 100%, 25.1%)#800080
Tealhsl(180, 100%, 25.1%)#008080
Navyhsl(240, 100%, 25.1%)#000080
Orangehsl(38.8, 100%, 50%)#ffa500
Tomatohsl(9.1, 100%, 63.9%)#ff6347

Other colors: use the converter above or the Color Converter.

FAQ

Frequently Asked Questions

Answers to common questions about HSL to HEX on ToolCube.

What is hsl(0, 100%, 50%) in HEX?

It is pure red, #ff0000.

Does HSL to HEX lose information?

HEX is limited to whole RGB values, so the result is rounded to the nearest of 16.7 million colors. The difference is never visible.

How do I convert hsla with transparency?

The alpha becomes the last two digits of an 8-digit HEX code, such as #ff660080 for 50%.