RGB / HSL Converter

The RGB to HSL converter translates a colour from the red, green and blue values used by screens into the hue, saturation and lightness model that designers find easier to reason about, and it shows the matching hex code as well. RGB describes a colour by how much of each primary light it contains, with each channel running from 0 to 255, which is precise but hard to adjust by eye. HSL describes the same colour as an angle on the colour wheel from 0 to 360 degrees for hue, a saturation percentage that runs from grey to vivid, and a lightness percentage that runs from black through the pure colour to white. Because those three numbers map to how we actually talk about colour, HSL makes it simple to nudge a shade lighter, mute it, or rotate the hue while keeping the feel. Enter the red, green and blue values and the tool returns the HSL triple and the six digit hex string you can paste straight into CSS. Web designers, front end developers and anyone building a palette use it to move between the format a tool gives them and the format their code or design system expects. A couple of tips help. When building a palette, hold hue and saturation steady and vary only lightness to get a coherent set of tints and shades. Remember that HSL lightness is not the same as perceived brightness, so two colours at the same lightness can look different in weight. Everything is computed locally in your browser, so no colour data is uploaded.

hsl(221, 83%, 53%)
HSL
Hex code#2563eb
RGBrgb(37, 99, 235)

HSL is derived from the normalised red, green and blue values. Hue is in degrees, saturation and lightness are percentages.

How it works

The tool divides each channel by 255, then finds the largest and smallest of the three. Lightness is the average of those two, saturation comes from their difference relative to the lightness, and hue is the angle set by whichever channel is largest. The values are rounded to whole degrees and percentages.

Worked example

For red 37, green 99 and blue 235, the largest channel is blue, giving a hue near 221 degrees. The spread of channels gives 83 percent saturation and 53 percent lightness, so the colour is hsl(221, 83%, 53%), the same as hex #2563eb.

Related calculators

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

© 2019 to 2026 Calculate.co.nz. All rights reserved.