HomeConvertersColorRGB to HSL color conversion
Color conversion

RGB to HSL color conversion

Convert RGB (0–255) to HSL (hue °, saturation %, lightness %). Standard formulas, worked examples, and color chart. Runs locally in your browser.

Instant result
Result

Enter values to convert.

Inputs
Mode
Formula

Formulas

Core equations used by this converter.

R'R' = R / 255
G'G' = G / 255
B'B' = B / 255
CmaxCmax = max(R', G', B')
CminCmin = min(R', G', B')
isRGB-style 8-bit channels (0–255) unless noted. Calculation runs locally in your browser.

How to use

1

Choose RGB → HSL or HSL → RGB

Use the tabs in the converter to switch direction.

2

Enter RGB or HSL values

Fill in the active fields for the selected direction.

3

Convert and read the result

Use Convert or let the result update automatically.

Example conversions

Common values with formula and result.

ϟ

rgb(255, 0, 0) → HSL

rgb(255, 0, 0) → HSL

R'=1, G'=0, B'=0 → Cmax=1, Cmin=0, Δ=1
hsl(0°, 100%, 50%)
ϟ

rgb(0, 255, 0) → HSL

rgb(0, 255, 0) → HSL

→ hsl(120°, 100%, 50%)
hsl(120°, 100%, 50%)
ϟ

rgb(128, 128, 128) → HSL

rgb(128, 128, 128) → HSL

Δ = 0 → H = 0°, S = 0%, L = 50%
hsl(0°, 0%, 50%)

RGB to HSL color conversion specification

Version 1.1.0 · Engine tested

Calculation status
  • Engine tested 3 published cases
  • Named expert review Not performed
  • Calculation version 1.1.0

Review policy

Definition
**RGB** — additive red/green/blue, each **0–255**. **HSL** — **Hue** (0–360°), **Saturation** (0–100%), **Lightness** (0–100%). Hue is the color angle; lightness moves toward black (0%) or white (100%).
What it calculates
Convert RGB (0–255) to HSL (hue °, saturation %, lightness %). Standard formulas, worked examples, and color chart.
Inputs
  • Values required by the selected conversion mode
Outputs
  • Converted result in the target unit or format
Formula
R' = R / 255 · G' = G / 255 · B' = B / 255
RGB to HSL color table
Color nameHexRGBHSL
Black#000000(0,0,0)(0°, 0%, 0%)
White#FFFFFF(255,255,255)(0°, 0%, 100%)
Red#FF0000(255,0,0)(0°, 100%, 50%)
Lime#00FF00(0,255,0)(120°, 100%, 50%)
Blue#0000FF(0,0,255)(240°, 100%, 50%)
Yellow#FFFF00(255,255,0)(60°, 100%, 50%)
Cyan#00FFFF(0,255,255)(180°, 100%, 50%)
Magenta#FF00FF(255,0,255)(300°, 100%, 50%)
Silver#C0C0C0(192,192,192)(0°, 0%, 75%)
Gray#808080(128,128,128)(0°, 0%, 50%)
Maroon#800000(128,0,0)(0°, 100%, 25%)
Olive#808000(128,128,0)(60°, 100%, 25%)
Assumptions
  • Conversion runs locally in the browser; values are not uploaded.
  • Uses the formulas documented on this page.
Units
  • R'
  • G'
  • B'
Boundary conditions
  • Empty or invalid input yields no valid result.
  • Out-of-range values may be rejected by the tool runtime.
Example
rgb(255, 0, 0) → HSL → hsl(0°, 100%, 50%)
Validation cases
  • rgb(255, 0, 0) → HSL → hsl(0°, 100%, 50%)
  • rgb(0, 255, 0) → HSL → hsl(120°, 100%, 50%)
  • rgb(128, 128, 128) → HSL → hsl(0°, 0%, 50%)
Sources
  • CalculatorX converter runtime
  • Standard unit / encoding definitions where applicable
Calculation version
1.1.0

Background

Interpretation and common distinctions.

Use the converter tabs to switch direction when available. Results for RGB to HSL color conversion update locally in your browser.

Frequently asked questions

Key distinctions behind the conversion.

How do you convert using RGB to HSL color conversion?

Use R' = R / 255. Example: rgb(255, 0, 0) → HSL → hsl(0°, 100%, 50%).

Can I switch direction?

Open the related reverse converter listed under Related tools.

Does this run online or locally?

Calculation runs locally in your browser. Values are not uploaded.

How precise are the results?

Results follow the formulas on this page. Round to the precision your use case needs.