Free Color Converter — HEX, RGB, HSL and Alpha
This is a free online color converter that translates any CSS color between HEX, HEX + Alpha, RGB, RGBA, HSL, and HSLA in real time. Paste #ec4899, rgb(236, 72, 153), hsl(330, 81%, 60%), or a CSS named color like tomato, and every format updates at once. Drag the native color picker or fine-tune with per-channel sliders for R, G, B, H, S, L, and alpha — the swatch reflects changes instantly so you can see exactly what you’re building.
Every conversion runs locally in your browser. Nothing is uploaded, nothing is logged, and the tool keeps working if you disconnect from the internet after the page has loaded.
HEX, RGB, HSL — what’s the difference?
All three formats describe exactly the same color — they just spell it out differently. Which one to use comes down to the context, not the color itself.
HEX
HEX (like #ec4899) is a compact six-digit notation for the red, green, and blue channels. The first two hex digits are red, the next two are green, and the last two are blue — each pair ranges from 00 to FF, which is 0 to 255 in decimal. An eight-digit HEX (#ec4899ff) adds an alpha byte on the end. HEX is the most compact format and dominates web design files, style guides, and icon exports.
RGB / RGBA
RGB (rgb(236, 72, 153)) writes the same three channels as decimal numbers from 0 to 255. RGBA adds a fourth value — alpha — from 0 (fully transparent) to 1 (fully opaque). RGB is the format you’ll reach for when you want to compute colors programmatically (lerp between two shades, invert a channel, tint an image) because the numbers map directly to what the screen does.
HSL / HSLA
HSL (hsl(330, 81%, 60%)) describes a color by hue (an angle on the color wheel, 0–360), saturation (how vivid, 0%–100%), and lightness (how bright, 0%–100%). HSLA adds alpha. HSL is dramatically easier to reason about than RGB: drop the lightness to darken a color, drop the saturation to mute it, rotate the hue to shift it around the wheel. That makes it the right format when you’re generating a palette or building a theme with CSS custom properties.
How to use this color converter
From a picker
- Click Pick a color to open your browser’s native color picker.
- Choose a color — the swatch, every output row, and every slider update instantly.
- Click Copy on any output row to grab the value in the format you need.
From a pasted value
- Paste any CSS color into the text input:
#ec4899,rgb(236, 72, 153),hsl(330, 81%, 60%),rgba(236, 72, 153, 0.5), or a named color liketomato,rebeccapurple,steelblue. - The swatch and all six output formats refresh as you type.
- Copy whichever output your target tool or codebase expects.
From the sliders
- Drag the R, G, B sliders for pixel-level control over each channel, or the H, S, L sliders to shift hue, saturation, or lightness while keeping the other two fixed.
- Use the alpha slider to dial transparency from
0to1. - Every slider is two-way bound with the number field next to it — type an exact value when you need it.
Alpha and transparency
Alpha controls how much of whatever sits behind a color shows through. alpha: 0 is fully transparent (invisible), alpha: 1 is fully opaque (solid), and anything in between is a mix. In CSS you can express alpha three ways:
- RGBA —
rgba(236, 72, 153, 0.5) - HSLA —
hsla(330, 81%, 60%, 0.5) - 8-digit HEX —
#ec489980(last two digits are alpha,00–FF)
Some design tools (Figma, Sketch, Tailwind) use 8-digit HEX; others (most stylesheets) prefer RGBA or HSLA. Copy whichever one the destination expects — this tool emits all three.
Common use cases
- Design → CSS — paste a HEX from a Figma swatch and grab RGBA with the alpha you need for a semi-transparent overlay.
- Building a theme — start from a brand HEX, jump to HSL, and generate lighter/darker variants by stepping lightness up and down.
- Named → HEX — convert
tomato,coral, orrebeccapurpleinto a HEX for a palette file. - Legacy formats — paste an old
rgb()and get the modernhsl()equivalent for a CSS refactor. - Alpha conversions — translate a transparent HEX like
#ec489980into thergba()syntax that older tools still require.
Accessibility: picking readable colors
Color choices affect accessibility more than any other design decision. WCAG requires a contrast ratio of at least 4.5:1 between normal text and its background, or 3:1 for large text (18pt+, or 14pt bold). Working in HSL makes it easy to hit those targets: raise the lightness of your text, drop the lightness of your background, or both. A rough heuristic: if two colors differ by 40 points or more in HSL lightness, they are usually close to AA contrast — verify with a dedicated contrast checker before shipping.
What about P3, OKLCH, and other modern formats?
This tool emits the classic sRGB-space formats — HEX, rgb(), rgba(), hsl(), hsla() — because those are supported everywhere, from a ten-year-old email client to the newest build system. Newer CSS formats like color(display-p3 …), oklch(), and lab() unlock a wider gamut on modern displays and are worth adopting when your target browsers support them, but for almost every existing design, CMS, or codebase the sRGB triplet is still the right answer. If you need to paste or export those newer formats, most design tools can round-trip them to HEX without a visible difference for colors inside the sRGB gamut.
Privacy and offline use
Every conversion happens locally in your browser with plain JavaScript — the color input, the picker, and the sliders never leave your device. Nothing is logged, nothing is cached on a server, and the page keeps working after you go offline. That matters when you’re sampling colors from a confidential mockup or internal brand file and don’t want the values leaking into third-party analytics.