Hex to RGB Converter

Convert CSS hex codes to RGB, RGBA & HSL โ€” with live preview

#D4AF37rgb(212, 175, 55)hsl(46, 65%, 52%)Text on WhiteText on Black

Presets

Input

With or without #, 3-digit or 6-digit โ€” both supported

Controls the alpha value in the RGBA output

Channel Breakdown

Red

212

83%

Green

175

69%

Blue

55

22%

CSS Output

HSL Breakdown

Hue

46ยฐ

Saturation

65%

Lightness

52%

๐ŸŽฏ A Simple Example: Converting a Brand Color for a CSS Theme

Your designer hands you a brand spec with the hex code #E63946. You need it in multiple CSS formats for your design system. Here's the workflow:

Just do this:

1๏ธโƒฃ Type #E63946 in the hex field โ€” a vivid red swatch appears instantly with R: 230, G: 57, B: 70

2๏ธโƒฃ Click Copy RGB โ†’ paste rgb(230, 57, 70) into your CSS for solid backgrounds

3๏ธโƒฃ Drag Opacity to 15%, then Copy RGBA โ†’ rgba(230, 57, 70, 0.15) for a soft alert background tint

4๏ธโƒฃ Click Copy HSL โ†’ hsl(356, 76%, 56%). In your CSS variables, swap 56% for 40% to get a darker hover state โ€” no new hex hunting needed

Pro tip: HSL is the designer's format. Once you know the hue and saturation, you can create a full tonal scale (light/mid/dark) by only adjusting the lightness value.

Data Source: W3C CSS Color Level 4 Specification โ€ข Public domain โ€ข Solo-developed with AI

Find Color Reference Tools on Amazon

As an Amazon Associate, I earn from qualifying purchases.

Lab Notes

The Six Characters That Built the Web: A History of Hex Color

A Shorthand for Light: Every color on a modern screen is a mixture of red, green, and blue light โ€” the additive primaries that LCD and OLED panels use. Each channel has 256 possible intensities (0โ€“255 in decimal), which maps neatly to two hexadecimal digits (00โ€“FF). The notation #RRGGBB packs all three channels into six compact characters, making it easy to type, copy, and read without needing a separate calculator. The entire visible palette of 16,777,216 colors fits in a format shorter than most passwords.

From Mosaic to W3C: The hex color format was popularized in 1994 by the NCSA Mosaic browser, which borrowed the convention from the X Window System's color naming infrastructure. Early HTML pages used it informally in attributes like bgcolor="#000080". By 1996, HTML 3.2 formally standardized the notation, and it became permanent web infrastructure. Thirty years later, browsers still parse the same six-character strings โ€” a rare case of computing backwards-compatibility holding firm across hardware generations.

Why RGB, HSL, and RGBA All Matter: RGB is hardware-native โ€” monitors literally mix those three light beams. But designers think differently. HSL (Hue, Saturation, Lightness) aligns with human color intuition: rotate the hue, pull back the saturation, and you get natural-feeling tonal variants without hunting for new numbers. CSS introduced hsl() in CSS Level 3 precisely for this reason. RGBA adds the alpha channel for transparency โ€” critical for overlays, shadows, and glass-morphism effects that are impossible with solid hex codes alone. Modern design systems use all three formats for different purposes in the same stylesheet.

The 3-Digit Shorthand: A lesser-known feature: #RGB is valid CSS shorthand where each digit is doubled โ€” #F0C expands to #FF00CC. This was introduced in CSS Level 1 (1996) and is still fully supported in every browser. It saves keystrokes when working with colors that happen to have repeated hex pairs, which is surprisingly common in rounded palette systems and design tokens.

๐Ÿพ From the Lab Cat's Desk: Humans invented six-character codes to classify colours as if cataloguing specimens. I find this admirable โ€” I classify colours too, but my vocabulary consists of: "sunlit dust," "warm laptop," and "suspicious." The code #FF6B35 describes what I call "suspicious orange." It appears frequently on Amazon delivery boxes, which I treat as both territorial threat and structural opportunity. I shall now sit on your color picker and redefine your palette. ๐ŸŽจ๐Ÿพ

In short: These tools are for education and curiosity only. Always verify information independently and consult professionals before making important decisions.

Riatto.ovh ยฉ 2025 โ€“ 2026. Designed and maintained by a solo developer with AI.

Privacy Policy

Also by us: Purr.ovh ยท Snackword.ovh ยท Substack