Blogs

Tools

Quick Links

Mridul.tech

Hex to HSL Color Converter

Convert Hex to HSL color codes. Enter Hex values and get the corresponding HSL color code.

Preview Color:

Swap

HSL Color Code

Hex to HSL color table

ColorNamehexhsl
Black#000000(0,0%,0%)
White#FFFFFF(0,0%,100%)
Red#FF0000(0,100%,50%)
Lime#00FF00(120,100%,50%)
Blue#0000FF(240,100%,50%)
Yellow#FFFF00(60,100%,50%)
Cyan#00FFFF(180,100%,50%)
Magenta#FF00FF(300,100%,50%)
Silver#C0C0C0(0,0%,75%)
Gray#808080(0,0%,50%)
Maroon#800000(0,100%,50%)
Olive#808000(60,100%,50%)
Green#008000(120,100%,50%)
Purple#800080(300,100%,50%)
Teal#008080(180,100%,50%)
Navy#000080(240,100%,50%)

What is a Hex Color Code?

A Hex color code is a six-digit value starting with a # that represents colors in HTML, CSS, and digital graphics. It is composed of three pairs of characters, each indicating the intensity of Red, Green, and Blue.

  • Format: #RRGGBB
  • Example: #1ABC9C
  • Breakdown: 1A for Red, BC for Green, 9C for Blue.

The Hex code is widely used because it is compact and easily recognized in web development.

What is an HSL Color Code?

The HSL color model represents colors using three values:

Hue (H): The type of color, represented in degrees on the color wheel (0–360).

  • 0° = Red
  • 120° = Green
  • 240° = Blue

Saturation (S): The intensity of the color (0%–100%).

  • 0% = gray (no color)
  • 100% = full, vivid color

Lightness (L): The brightness of the color (0%–100%).

  • 0% = black
  • 50% = normal color
  • 100% = white

Example: hsl(168, 76%, 42%)

Why Convert Hex to HSL?

While Hex codes are excellent for web coding, HSL offers more intuitive color control:

  • Better Color Adjustments: HSL makes it easy to tweak hue, saturation, and brightness individually.
  • Design Flexibility: Designers prefer HSL when working with gradients and themes.
  • User-Friendly: HSL values are easier to understand compared to Hex codes.
  • CSS Support: Modern CSS fully supports HSL and HSLA (HSL with alpha for transparency).

How to Use Our Hex to HSL Color Converter

Our tool is built to be simple, accurate, and fast. Here’s how to use it:

  • Visit the Tool Page: Go to our Hex to HSL Color Converter.
  • Enter a Hex Code: Type or paste any valid Hex color code (e.g., #e74c3c).
  • Get Instant Conversion: The tool instantly provides the HSL equivalent.
    • Example: #e74c3c → hsl(6, 78%, 57%)
  • Copy and Use: Copy the HSL code and use it in your CSS, design software, or projects.

Examples of Hex to HSL Conversion

  • Hex: #FFFFFF → HSL: hsl(0, 0%, 100%) (White)
  • Hex: #000000 → HSL: hsl(0, 0%, 0%) (Black)
  • Hex: #FF0000 → HSL: hsl(0, 100%, 50%) (Red)
  • Hex: #00FF00 → HSL: hsl(120, 100%, 50%) (Green)
  • Hex: #0000FF → HSL: hsl(240, 100%, 50%) (Blue)

Manual Conversion Formula: Hex to HSL

If you prefer to calculate manually, follow these steps:

  • Convert the Hex value to RGB.
    • Example: #4CAF50 → RGB(76, 175, 80).
  • Normalize RGB values by dividing each by 255.
    • R = 0.298, G = 0.686, B = 0.314.
  • Find max and min values among R, G, and B.
    • Max = 0.686, Min = 0.298.
  • Calculate Lightness (L):
    • L = (Max + Min) / 2 → 0.492 (49%).
  • Calculate Saturation (S):
    • If Max = Min, S = 0.
    • Else, S = (Max - Min) / (1 - |2L - 1|).
  • Calculate Hue (H):
    • If Max = R → H = (G - B) / (Max - Min).
    • If Max = G → H = 2 + (B - R) / (Max - Min).
    • If Max = B → H = 4 + (R - G) / (Max - Min).
  • Multiply H by 60 to get degrees.
  • Final Result: hsl(122, 39%, 49%).

Advantages of Using Hex to HSL Converter

  • Instant Results: Save time by skipping manual calculations.
  • Accurate Conversions: Always get precise HSL values.
  • Easy to Use: Enter a Hex code and copy the result.
  • Supports Designers and Developers: Perfect for CSS, themes, and branding work.

Frequently Asked Questions (FAQs)

What’s the main difference between Hex and HSL?

Hex is a numeric shorthand for RGB values, while HSL represents colors in terms of hue, saturation, and lightness.

Can I convert HSL back to Hex?

Yes, you can convert HSL values back to Hex using an HSL to Hex converter.

Is HSL better than Hex for web design?

HSL is easier for adjusting shades and brightness, while Hex is more compact. Both are widely supported in CSS.

Do all browsers support HSL?

Yes, all modern browsers support both HSL and HSLA.

Can shorthand Hex codes (#FFF) be converted?

Yes, the converter automatically expands shorthand Hex codes like #FFF into #FFFFFF before conversion.

Why do designers prefer HSL in CSS?

Because HSL makes it much simpler to create lighter, darker, or muted versions of a color compared to Hex.

Is there a limit to conversions in the tool?

No, you can convert as many colors as you want, free of cost.

Do you want more articles on React, Next.js, Tailwind CSS, and JavaScript?

Subscribe to my newsletter to receive articles straight in your inbox.

If you like my work and want to support me, consider buying me a coffee.

Buy Me A Coffee

Contact Me ☎️

Discuss A Project Or Just Want To Say Hi?
My Inbox Is Open For All.

Mail : contact@mridul.tech

Connect with me on Social Media

Contact Art