Color Converter

Convert colors between HEX, RGB, HSL, and RGBA with a live swatch, color picker, alpha slider, and recent color history.

runs locally on your browser. Your data never leaves your device.
R
G
B
H
S
L
rgba(59, 130, 246, 1)

Common Use Cases

Convert a brand colour from hex to HSL to create tints and shades for a design system
Get the RGBA equivalent of a hex colour to add transparency in CSS
Identify which Tailwind CSS colour is closest to a hex code from a design file
Convert colours between formats when working between Figma and a CSS stylesheet

About Color Converter

Color representation in web and digital design relies on several competing formats, each with different strengths. Hex codes (like `#3B82F6`) are compact, copy-paste friendly, and universally understood by browsers and design tools, but they're opaque to human interpretation. RGB values (`rgb(59, 130, 246)`) are more readable and align with how screens actually produce color (mixing red, green, and blue light at varying intensities), but are still hard to reason about intuitively. HSL (`hsl(217, 91%, 60%)`) is the most human-friendly format: Hue (0–360° on the colour wheel), Saturation (0–100%), and Lightness (0–100%). HSL makes it trivial to create consistent colour palettes: just vary the lightness for tints and shades, or shift the hue for analogous colours.

CSS supports all of these formats, and choosing the right one for the job makes your code more maintainable. Use hex for fixed brand colours referenced in CSS variables. Use HSL in CSS when building dynamic themes where you want to algorithmically darken or lighten a colour. Use RGBA (`rgba(59, 130, 246, 0.5)`) or `hsl()` with an alpha channel when you need transparency.

In design tools like Figma and Sketch, colours are typically stored as RGB/HSL but exported as hex. When handing off designs to developers, hex is the most portable format. When working in Tailwind CSS, colours map to config values, so knowing the HSL or hex equivalent helps you find the closest Tailwind colour or define a custom one.

This converter handles all four formats with a live swatch preview, alpha transparency, and a recent colour history so you can switch between colours without re-entering them.

Frequently Asked Questions

What is the difference between RGB and RGBA?
RGB (Red, Green, Blue) uses three channels each ranging from 0 to 255 to define a fully opaque colour. RGBA adds a fourth alpha channel (0.0 = fully transparent, 1.0 = fully opaque) to control transparency. In CSS, rgba(59, 130, 246, 0.5) produces the same blue as rgb(59, 130, 246) but at 50% opacity.
Why does HSL make it easier to build colour palettes?
In HSL, if you keep the Hue and Saturation constant and only change the Lightness, you get a perfect range of tints and shades of the same colour. For example, hsl(217, 91%, 20%) is a very dark blue, hsl(217, 91%, 60%) is the normal blue, and hsl(217, 91%, 90%) is a very light pastel blue, all on the same colour 'tone'. This is how most design systems generate their colour scales.
What is the difference between 3-digit and 6-digit hex codes?
A 3-digit hex code (like #3BF) is a shorthand where each digit is doubled, so it's equivalent to #33BBFF. This shorthand only works when both digits of each colour channel are the same. All 3-digit hex codes can be expanded to 6 digits, but not all 6-digit codes can be shortened to 3 digits.
What is an 8-digit hex code?
An 8-digit hex code (like #3B82F6AA) includes an alpha transparency channel as the last two hex digits. The range is 00 (fully transparent) to FF (fully opaque). 50% opacity is approximately 80 in hex (128/255 ≈ 0.502). 8-digit hex codes are supported in all modern browsers via CSS.