Skip to content
CertoflowCertoflow
Color Tools

HSL to Hex Converter

Convert HSL to hex color codes.

Last updated: June 2026

#336699

Guide

Introduction

HSL puts intuitive controls on color — spin hue to shift the wheel, raise saturation for vividness, adjust lightness for tints and shades. Designers think in these terms when iterating themes, but deployment pipelines, design token JSON, and most handoff specs still want hexadecimal #RRGGBB. Converting hsl(221, 83%, 53%) to #2563eb by hand requires RGB intermediate math most developers would rather skip.

Certoflow's HSL to Hex Converter accepts hue (0–360), saturation (0–100%), and lightness (0–100%), then outputs lowercase hex with a live preview. Processing is entirely client-side — your palette experiments stay private. Light and dark themes keep slider controls readable during extended design system work.

What this tool does

FeatureBehavior
InputHue slider 0–360, saturation 0–100%, lightness 0–100%
Output#rrggbb hex string
PreviewReal-time swatch as sliders move
CopyOne-click hex clipboard export
ClampingOut-of-range values clamp to valid bounds

Interactive sliders make exploratory palette tuning fast — nudge lightness down for hover states, rotate hue for secondary accents.

How it works

HSL-to-hex conversion reverses the CSS standard algorithm:

  1. Normalize hue to 0–360, saturation and lightness to 0–1 fractions
  2. Compute chroma and intermediate RGB components based on hue sector (60-degree segments)
  3. Add lightness offset to produce sRGB channels
  4. Encode channels as two-digit hex pairs
// Simplified pipeline
const rgb = hslToRgb(221, 83, 53);
const hex = rgbToHex(rgb.r, rgb.g, rgb.b);
// → #2563eb

Hue wraps modulo 360. At saturation 0, all hues produce gray — only lightness affects output. At lightness 0 or 100, output approaches black or white regardless of hue.

Certoflow shares hslToRgb with Hex to HSL and Complementary Color Generator for consistent round-trip conversion.

Example conversions:

HSL inputHex output
hsl(0, 0%, 0%)#000000
hsl(0, 0%, 100%)#ffffff
hsl(0, 100%, 50%)#ff0000
hsl(120, 100%, 50%)#00ff00
hsl(221, 83%, 53%)#2563eb

Real-world examples

Hover state generation

Base button: hsl(221, 83%, 53%). Reduce lightness to 43% on the slider, copy new hex for :hover rule. Hue and saturation unchanged — visually coherent state change.

Secondary accent exploration

Primary hue 221 degrees. Rotate to 251 for analogous accent or 41 for triadic exploration. Copy each hex candidate into Color Contrast Checker before selecting text colors.

Converting documented HSL tokens

Style guide lists hsl(224, 71%, 40%) for headings. Enter values, copy hex for Figma variables or iOS asset catalogs that require hex input.

Random palette refinement

Random Color Generator produces hex. Convert to HSL with Hex to HSL, adjust saturation down for muted UI backgrounds, convert back here for final hex token.

CSS gradient stop preparation

Tune three HSL colors with consistent hue spacing, export hex values, paste into CSS Gradient Generator for linear-gradient output.

Common mistakes

Entering saturation/lightness without percent mindset. CSS HSL uses 0–100% for s and l, not 0–1 decimals. Value 0.53 is wrong; 53% is correct.

Expecting HSV slider values to match. Photoshop HSV "value" differs from HSL "lightness." Importing HSV numbers produces unexpected hex.

Ignoring hue wraparound. Hue 370 degrees equals 10 degrees. Certoflow normalizes modulo 360.

Assuming high saturation always produces vivid colors. At very low or very high lightness, even 100% saturation yields near-white or near-black results.

Skipping contrast validation. A pleasing HSL combination may fail WCAG. Always check text pairings with Color Contrast Checker.

Round-trip drift. Hex → HSL → hex may differ by one channel digit from rounding. Accept minor variance or use original hex as source of truth.

Related tools

Color category:

Cross-category:

Browse /color for the full toolkit.

FAQ

Is data sent to a server?

No. HSL math and hex encoding run locally in your browser.

What ranges do sliders use?

Hue 0–360 degrees. Saturation and lightness 0–100 percent.

Does output match CSS hsl() in browsers?

Yes. Certoflow implements CSS Color Level 3 algorithms.

Can I paste hsl(221, 83%, 53%) as text?

Use the numeric sliders or enter parsed values. For string parsing from hex, use Hex to HSL.

Why lowercase hex?

Modern CSS convention. Hex is case-insensitive.

Works offline?

Yes, after page load.

Dark mode supported?

Yes. Toggle Certoflow theme as needed.

How do I create shades from output hex?

Copy result to Color Shades Generator.

HSL input from Tailwind?

Extract HSL components from arbitrary values or config, enter here for hex export to non-Tailwind systems.

Difference from Developer Hex Converter?

Hex Converter encodes text bytes — unrelated to HSL color math.

Frequently Asked Questions

What HSL ranges are used?
Hue 0–360, saturation and lightness 0–100 percent.
Does it match browser HSL?
Uses standard HSL-to-RGB conversion aligned with CSS Color Level 3.

Related tools that complement this workflow.