Tools / Color Converter / HSL → HEX

HSL to HEX Converter.

HSL to HEX turns a human-friendly hue/saturation/lightness triple back into the six-digit string CSS and design tools expect. Internally it goes HSL → RGB → HEX; the interesting math is the HSL → RGB step, which reconstructs the three channels from the hue sector.

HEX —
All formats

    The HSL → HEX formula

    C = (1 − |2L−1|)·S, X = C·(1 − |(H/60 mod 2) − 1|), m = L − C/2. Pick the (R,G,B) ordering by hue sector, add m, scale to 0-255, then hex-encode.

    Worked example

    Convert hsl(220, 49%, 21%):

    1. C = (1 − |2·0.21 − 1|)·0.49 ≈ 0.21
    2. Hue 220° falls in the 180-240 sector → (0, X, C)
    3. Add m and scale → rgb(27, 45, 80)
    4. Hex-encode → #1B2D50

    JavaScript

    // hslToRgb then rgbToHex (see colorConvert.ts)
    hslToRgb({h:220,s:49,l:21}); // {r:27,g:45,b:80}
    rgbToHex({r:27,g:45,b:80});  // "#1B2D50"

    FAQ

    Do I even need hex if CSS supports hsl()?

    Modern CSS accepts hsl() directly, so for stylesheets you often don't. Hex is still required by many design tools, brand guidelines, and APIs that only accept a 6-digit string.

    Paid links below. As an Amazon Associate we earn from qualifying purchases.

    Library

    Colour references for your next project

    Compare the original references behind this archive. Check the contents, edition and format before choosing a book.

    Book links are Amazon Associates affiliate links. Your price is unchanged; a small commission supports the archive. As an Amazon Associate we earn from qualifying purchases.

    • A Dictionary of Color Combinations by Sanzo Wada — book cover

      Sanzo Wada

      A Dictionary of Color Combinations

      The 2010 Seigensha republication of the 1933–34 original. Japanese import.

      The printed original behind this archive: Wada's 1933–34 combinations on Seigensha's matte plates, in a Japanese binding small enough to carry, and a copy you can cite. Every plate is also free to browse here, hex values and all. Already know it? Vol. 2 is a different book of his later work.

    • A Dictionary of Color Combinations Vol. 2 by Sanzo Wada — book cover

      Sanzo Wada

      A Dictionary of Color Combinations Vol. 2

      Seigensha, 2020. Japanese import.

      Wada's 1935–36 and 1938 follow-ups: 72 plates on the Japanese seasons and 165 drawn from early-century fashion, interior, and graphic design. Not in Vol. 1. Not in this archive. The book itself is a design object — Japanese binding, matte pages, zero captions.

    Torn between the two Wada dictionaries? Vol 1 vs Vol 2, compared plate by plate →

    Book links are Amazon Associates affiliate links. Your price is unchanged; a small commission supports the archive. As an Amazon Associate we earn from qualifying purchases.

    Last updated

    Looking for a combination we don’t have yet?

    Tell us the colour, mood, or palette you were after — it shapes which editorial combinations we add next.

    Did you find what you were looking for?

    Not quite? Tap what was off: