Color Converter -- HEX to RGB to HSL Explained

Published 2026-05-30

The format mismatch problem

You grab a brand color from a design file in hex -- say #3B82F6. Then your CSS animation needs it in HSL so you can adjust the lightness on hover. Or your JavaScript canvas API wants rgb() values. Suddenly you are juggling three notations for the same color, and converting between them by hand means math you should not have to do.

Different tools and platforms default to different formats. Figma exports hex, Tailwind configuration uses hex, CSS custom properties often use HSL for easy theming, and older codebases are full of rgb(). A quick color converter eliminates the friction of moving between them.

How to convert colors

  1. Open the Color Converter.
  2. Enter a color in any supported format -- hex, RGB, or HSL.
  3. The tool instantly shows the equivalent value in every other format.
  4. Copy the format you need with one click.

When to use HEX vs RGB vs HSL

Each format has strengths depending on context:

How color conversion works

HEX is just RGB in base-16 notation. #3B82F6 breaks into three pairs: 3B = 59 red, 82 = 130 green, F6 = 246 blue. Converting between hex and RGB is straightforward base conversion.

RGB to HSL is more involved. The algorithm finds the maximum and minimum channel values, uses them to calculate lightness (the average of max and min), saturation (based on the range between max and min), and hue (based on which channel is dominant and the offset of the others). The reverse -- HSL to RGB -- uses sector-based math to map the hue angle back to channel intensities.

CSS color formats reference

Modern CSS also supports the space-separated syntax: rgb(59 130 246 / 0.5) and hsl(217 91% 60% / 0.5).


Built with vanilla HTML/JS. No frameworks, no backend, loads instantly.

Related tools

Joe — Software engineer with 20+ years of experience. Built ToolRack to provide fast, private tools without the bloat.