COLOUR CONVERSION GUIDE
HSL to RGB Converter – Convert HSL, HEX and CSS Colours Online
Need to turn an HSL colour into RGB or HEX in a hurry? This free HSL to RGB converter does it the moment you type. Enter the hue, saturation and lightness of a colour, or drag the live gradient sliders, and the matching red, green and blue values appear instantly, together with the HEX code, the HSV (HSB) values and ready-to-paste code for CSS, Swift, Android and Flutter. It is built for web developers, UI designers, front-end engineers, students and anyone who works with colour codes. You can also use it as an RGB to HSL converter, because every field works in both directions, and you can add an alpha (opacity) value to get rgba, hsla and 8-digit HEX colours. Below the converter you will find colour harmony and shade generators that build complementary, analogous, triadic and tetradic palettes from your colour, and a batch tool that converts a whole list of HSL values into RGB and HEX and exports them as CSV. Everything runs inside your browser, with no signup, no watermark and no upload, so your colours stay private.
RGB
HSL to RGB Converter
Convert HSL to RGB online with accurate rounding and live preview. Set the hue angle from 0 to 360 degrees, then adjust saturation and lightness from 0 to 100 percent and read the red, green and blue channel values from 0 to 255. Each channel has its own bar, so you can see how the colour is built.
HEX
HSL to HEX Converter
Need a HEX code for your stylesheet, design tool or brand guide? The converter shows the 6-digit HEX code of every HSL colour and an 8-digit version that includes alpha. Type a HEX code to get HSL back, and copy any format with a single click.
+
Palette and Batch Tools
Create harmonious palettes from one colour with complementary, analogous, triadic, split-complementary and tetradic schemes, build a tint and shade scale, or paste a long list of HSL values and convert them all at once. Download the table as a CSV file for your project or design system.
How to Convert HSL to RGB Online (Step by Step)
You do not need a design app or a calculator to turn HSL into RGB. Follow these simple steps with our free colour converter.
- Enter the hue: Type a number from 0 to 360 or drag the rainbow slider. 0 is red, 120 is green and 240 is blue.
- Set the saturation: Choose how vivid the colour is, from 0 percent (grey) to 100 percent (full colour).
- Set the lightness: Choose how light or dark the colour is, from 0 percent (black) through 50 percent (pure colour) to 100 percent (white).
- Add transparency if you need it: Use the alpha slider from 0 (fully transparent) to 1 (fully opaque) to get rgba, hsla and 8-digit HEX values.
- Read the RGB values: The red, green and blue numbers update live, along with the HEX code, HSV values and developer snippets.
- Copy the format you need: Press Copy next to CSS, HEX, Swift, Android or Flutter output and paste it into your project.
To go from RGB or HEX to HSL, type into the RGB boxes or the HEX field, and the HSL fields and sliders update automatically. For many colours at once, use the batch converter.
What Is HSL? Hue, Saturation and Lightness Explained
HSL describes a colour in the way people naturally think about it. Instead of mixing red, green and blue light, you choose a colour on the colour wheel, decide how intense it is and then decide how light or dark it should be. That is why many designers find HSL easier to read and edit than RGB or HEX. If you want a slightly darker version of a button colour, you reduce the lightness by a few percent, and nothing else needs to change.
- Hue (H): The position on the colour wheel in degrees, from 0 to 360. Red starts at 0, green sits at 120, blue at 240, and the wheel returns to red at 360.
- Saturation (S): The intensity of the colour in percent. 100 percent is a rich, vivid colour, and 0 percent is a neutral grey.
- Lightness (L): How much white or black is mixed in. 0 percent is black, 100 percent is white, and 50 percent shows the colour at its most pure.
The table below lists the main hue angles and the colours they produce at 100 percent saturation and 50 percent lightness.
Hue angles and their colours
| Hue (degrees) |
Colour |
HSL |
RGB |
| 0° / 360° | Red | hsl(0, 100%, 50%) | 255, 0, 0 |
| 30° | Orange | hsl(30, 100%, 50%) | 255, 128, 0 |
| 60° | Yellow | hsl(60, 100%, 50%) | 255, 255, 0 |
| 120° | Green (lime) | hsl(120, 100%, 50%) | 0, 255, 0 |
| 180° | Cyan | hsl(180, 100%, 50%) | 0, 255, 255 |
| 240° | Blue | hsl(240, 100%, 50%) | 0, 0, 255 |
| 270° | Violet | hsl(270, 100%, 50%) | 128, 0, 255 |
| 300° | Magenta | hsl(300, 100%, 50%) | 255, 0, 255 |
| 330° | Rose | hsl(330, 100%, 50%) | 255, 0, 128 |
HSL vs RGB vs HEX: Which Colour Format Should You Use?
All three formats can describe the same colours on a screen, but they are written differently and suit different jobs. RGB and HEX describe how much red, green and blue light a pixel emits. HSL describes the colour in terms of hue, saturation and lightness, which is closer to how people think about colour. The table below compares them.
HSL vs RGB vs HEX
| Feature |
HSL |
RGB |
HEX |
| Example |
hsl(204, 70%, 53%) |
rgb(52, 152, 219) |
#3498DB |
| What it describes |
Hue, saturation, lightness |
Red, green, blue amounts |
The same RGB amounts in base 16 |
| Easy to read and adjust |
Very easy |
Moderate |
Hard to guess by eye |
| Best for |
Design systems, themes, hover states, palettes |
Image processing, canvas, animation |
Brand guides, design handoff, short code |
| Transparency |
hsla() or the alpha slash |
rgba() or the alpha slash |
8-digit HEX such as #3498DBCC |
| Supported in CSS |
Yes |
Yes |
Yes |
A practical approach is to design with HSL, because it is easy to adjust, and to convert to HEX or RGB when a tool, library or platform asks for it. This converter keeps all three formats in sync, so you never have to calculate by hand.
HSL to RGB Formula Explained With Examples
The conversion from HSL to RGB follows a precise formula. Knowing it helps you check results and write your own converter in any programming language.
- Normalise: Convert saturation and lightness from percent to fractions, so S and L are between 0 and 1.
- Calculate chroma: C = (1 − |2L − 1|) × S. Chroma is the strength of the colour.
- Calculate X: X = C × (1 − |(H ÷ 60) mod 2 − 1|). This is the second largest component.
- Calculate the offset: m = L − C ÷ 2. This lifts every channel to the right lightness.
- Choose the sector: Depending on the hue range (0–60, 60–120, 120–180, 180–240, 240–300, 300–360), the pair (R′, G′, B′) is (C, X, 0), (X, C, 0), (0, C, X), (0, X, C), (X, 0, C) or (C, 0, X).
- Finish: R = (R′ + m) × 255, G = (G′ + m) × 255 and B = (B′ + m) × 255, rounded to whole numbers.
Example 1: HSL(204, 70%, 53%). S = 0.7 and L = 0.53, so C = (1 − |1.06 − 1|) × 0.7 = 0.658. H ÷ 60 = 3.4, so X = 0.658 × (1 − |1.4 − 1|) = 0.395. Then m = 0.53 − 0.329 = 0.201. The hue is in the 180–240 sector, so (R′, G′, B′) = (0, X, C). Therefore R = 0.201 × 255 ≈ 51, G = 0.596 × 255 ≈ 152 and B = 0.859 × 255 ≈ 219. The result is RGB(51, 152, 219), which is HEX #3398DB.
Example 2: HSL(0, 100%, 50%). C = (1 − |1 − 1|) × 1 = 1, X = 1 × (1 − |0 − 1|) = 0 and m = 0. The hue is in the first sector, so (R′, G′, B′) = (C, X, 0) = (1, 0, 0). The result is RGB(255, 0, 0), pure red.
The table below lists common colours in HSL with their RGB and HEX values for quick reference.
Common colours: HSL to RGB and HEX
| Colour |
HSL |
RGB |
HEX |
| Black | 0, 0%, 0% | 0, 0, 0 | #000000 |
| White | 0, 0%, 100% | 255, 255, 255 | #FFFFFF |
| Grey | 0, 0%, 50% | 128, 128, 128 | #808080 |
| Red | 0, 100%, 50% | 255, 0, 0 | #FF0000 |
| Yellow | 60, 100%, 50% | 255, 255, 0 | #FFFF00 |
| Lime | 120, 100%, 50% | 0, 255, 0 | #00FF00 |
| Cyan | 180, 100%, 50% | 0, 255, 255 | #00FFFF |
| Blue | 240, 100%, 50% | 0, 0, 255 | #0000FF |
| Magenta | 300, 100%, 50% | 255, 0, 255 | #FF00FF |
| Maroon | 0, 100%, 25% | 128, 0, 0 | #800000 |
| Olive | 60, 100%, 25% | 128, 128, 0 | #808000 |
| Teal | 180, 100%, 25% | 0, 128, 128 | #008080 |
| Navy | 240, 100%, 25% | 0, 0, 128 | #000080 |
Using HSL Colours in CSS: hsl(), hsla() and Design Systems
CSS has supported hsl() and hsla() for many years, and every modern browser understands them. You can write the classic comma form, hsl(204, 70%, 53%), or the newer space-separated form with an optional alpha after a slash, hsl(204 70% 53% / 0.8). Because the three parts are independent, HSL is especially good for building consistent interfaces and themes.
A common pattern is to store the hue, saturation and lightness in CSS custom properties and build every state of a component from them:
:root {
--brand-h: 204;
--brand-s: 70%;
}
.button { background: hsl(var(--brand-h) var(--brand-s) 53%); }
.button:hover { background: hsl(var(--brand-h) var(--brand-s) 46%); }
.button:active { background: hsl(var(--brand-h) var(--brand-s) 40%); }
.button.soft { background: hsl(var(--brand-h) var(--brand-s) 94%); }
With this approach, changing the whole theme from blue to green only needs one new hue value. Dark mode is also easier, because you can adjust only the lightness. When a library, an image processor, a canvas script or an API needs RGB or HEX instead, convert your HSL values with this tool.
- Hover and focus states: Lower the lightness by 5 to 8 percent for a darker hover colour.
- Disabled and muted colours: Reduce the saturation to get a softer, greyer version of the same hue.
- Backgrounds and borders: Use very high lightness values (90 to 97 percent) for soft tinted backgrounds.
- Transparency: Add an alpha value for overlays, shadows and glass effects.
Colour Harmonies: Complementary, Analogous, Triadic and More
HSL makes classic colour harmonies easy, because every scheme is just a set of hue rotations on the colour wheel. Keep saturation and lightness the same, change the hue, and you get colours that work well together. The converter builds these palettes for you under the main tool, and you can click any swatch to load it. The table below explains each scheme.
Colour harmony schemes in HSL
| Scheme |
Hue rotation |
Look and feel |
| Complementary | +180° | High contrast, bold and energetic |
| Analogous | −30° and +30° | Calm, natural and harmonious |
| Triadic | +120° and +240° | Colourful and balanced |
| Split-complementary | +150° and +210° | Contrast with less tension than complementary |
| Tetradic (square) | +90°, +180° and +270° | Rich and varied, works best with one dominant colour |
Tints are made by adding white (higher lightness), shades by adding black (lower lightness) and tones by lowering the saturation. A good user interface palette usually combines one main hue with a range of tints and shades, plus one accent colour taken from a harmony.
HSL vs HSV (HSB) vs HWB: What Is the Difference?
HSL is part of a family of colour models that all use a hue angle. They differ in how they describe brightness, which is why the same colour has different numbers in each model. Colour pickers in many design apps use HSB, while CSS uses HSL and HWB.
HSL, HSV and HWB compared
| Model |
Channels |
Pure colour is at |
Common use |
| HSL | Hue, saturation, lightness | Lightness 50%, saturation 100% | CSS, themes, design systems |
| HSV / HSB | Hue, saturation, value (brightness) | Value 100%, saturation 100% | Colour pickers in Photoshop, Figma and similar apps |
| HWB | Hue, whiteness, blackness | Whiteness 0%, blackness 0% | CSS Color Level 4, intuitive mixing |
The tool shows the HSV (HSB) values next to HSL, so you can move a colour from a CSS file to a design app that uses a brightness slider without manual maths.
Does HSL Lightness Equal Perceived Brightness? Contrast and Accessibility
An important detail for accessible design is that HSL lightness is a mathematical value and not the brightness that people actually see. Pure yellow at 50 percent lightness looks much brighter than pure blue at the same 50 percent, because the human eye is more sensitive to green and yellow light than to blue. This means that two colours with the same lightness number can have very different contrast against a white or black background.
For text, buttons and icons, check the contrast ratio instead of relying on lightness. The Web Content Accessibility Guidelines (WCAG) ask for a contrast ratio of at least 4.5 to 1 for normal text and 3 to 1 for large text. HSL is still a great way to explore and organise colour, but always verify contrast with a contrast checker after you have chosen your final shades.
- Test every text and background pair: Do not assume that lightness 40 percent will always be readable on a light background.
- Do not rely on colour alone: Add icons, labels or patterns so that colour-blind users get the same information.
- Check both light and dark themes: A colour that works on white can fail on a dark background.
Common Uses of an HSL to RGB Converter
Colour conversion is a daily task for people in many fields. Here are some of the most popular ways to use an HSL to RGB and HEX converter.
- Web development: Convert HSL values from a stylesheet into RGB or HEX for JavaScript, canvas, SVG or charts.
- Design systems and tokens: Generate consistent colour scales and document their HEX and RGB equivalents.
- Mobile apps: Get ready-to-paste Swift, Kotlin and Flutter colour code for iOS and Android projects.
- UI and UX design: Prepare hover, active and disabled states and check them in different formats.
- Data visualisation: Create evenly spaced hues for charts, maps and legends.
- Game development and graphics: Convert colours for shaders, sprites and engines that need RGB.
- Branding and marketing: Keep the same brand colour across web, social media and presentation tools.
- Teaching and learning: Understand how colour models relate with a live, visual calculator.
- Email and CMS work: Many email clients and editors only accept HEX or RGB, so convert before you paste.
Tips for Working With HSL, RGB and HEX Colours
- Keep the hue, change the lightness: This is the fastest way to create a family of colours that clearly belong together.
- Limit saturation for large areas: Very high saturation looks tiring on big backgrounds, so use softer values there.
- Use whole numbers in handoff: Share HEX codes with developers, and keep the HSL values in your design tokens.
- Remember that 360 equals 0: Both are the same red, so a hue of 360 wraps around to 0.
- Check greys separately: At 0 percent saturation the hue does not matter, so every hue gives the same grey.
- Test on real screens: Phones, laptops and monitors show colours slightly differently.
- Add alpha last: Choose the solid colour first, then add transparency for overlays and shadows.
Troubleshooting: Why Does My Converted Colour Look Different?
- The RGB values are off by one: Different tools round differently, and a difference of one step is invisible.
- The HEX code is not accepted: Use 3, 4, 6 or 8 hexadecimal characters (0–9 and A–F), with or without the # symbol.
- The hue jumped to 0 for a grey: A grey has no real hue. This tool keeps the previous hue so your sliders do not jump.
- The batch tool says invalid colour: Make sure each line has three numbers, with hue from 0 to 360 and saturation and lightness from 0 to 100.
- The colour looks different in another app: Some programs apply a colour profile, so the same RGB values can look slightly different from the browser.
Convert HSL to RGB on Mobile, Windows and Mac
This online HSL to RGB converter works in any modern browser, including Chrome, Safari, Firefox and Edge, on Android, iPhone, iPad, Windows, macOS and Linux. There is nothing to install and no account to create. On a phone, use the sliders with your thumb or the number pad for exact values. On a computer, paste a list of HSL colours from your code editor into the batch converter and copy the result back as CSV. All calculations run inside your browser, so results are instant and your colour data never leaves your device.
Free HSL to RGB Colour Converter: Fast, Accurate and Private
We built this HSL to RGB converter to be the quickest and clearest way to move between colour formats. It is free, needs no signup, converts in both directions, supports alpha, shows HEX, HSV and developer formats, builds harmonies and shades, and includes a batch mode for entire palettes. Your colours never leave your browser.
Ready to try it? Scroll back up, set your hue, saturation and lightness and copy the RGB values for your next project. If you need other colour tools, explore the rest of the free tools on our site.