RGB to HEX Color Converter
FreeConvert RGB or RGBA color values to HEX instantly. Enter rgb(255, 87, 51), get #FF5733. Free, runs in your browser, no signup.
What's next
Settings guide
RGB value ranges:
| Channel | Min | Max | Meaning |
|---|---|---|---|
| R (Red) | 0 | 255 | 0 = no red, 255 = full red |
| G (Green) | 0 | 255 | 0 = no green, 255 = full green |
| B (Blue) | 0 | 255 | 0 = no blue, 255 = full blue |
| A (Alpha) | 0.0 | 1.0 | 0 = transparent, 1 = opaque (CSS range) |
Common RGB to HEX conversions:
- ·rgb(0, 0, 0) → #000000 (black)
- ·rgb(255, 255, 255) → #FFFFFF (white)
- ·rgb(255, 0, 0) → #FF0000 (red)
- ·rgb(0, 128, 0) → #008000 (green)
- ·rgb(0, 0, 255) → #0000FF (blue)
Output format options:
- ·Uppercase HEX (#FF5733) — convention in most design tools and CSS.
- ·Lowercase HEX (#ff5733) — preferred by some linters and CSS-in-JS libraries.
- ·Without # prefix (FF5733) — for APIs and systems that add the prefix themselves.
Format comparison
RGB vs HEX in CSS: Both work. HEX (#FF5733) is more compact. RGB (rgb(255, 87, 51)) is more readable for code review and makes partial color manipulation easier in JavaScript. RGBA is cleaner than 8-digit HEX for alpha values.
RGB vs HSL: RGB maps to screen hardware directly; HSL maps to human perception. Adjusting brightness in RGB means changing all three channels proportionally — in HSL you just change the L value. Choose the format your audience (browser, tool, or developer) expects.
RGB vs OKLCH: CSS Color Level 4 introduces OKLCH as a perceptually uniform alternative. A CSS custom property like color: oklch(70% 0.15 30) is easier to adjust than rgb(255, 87, 51). However, OKLCH has limited tooling support in 2025 — RGB and HEX remain the safe defaults for production CSS.
How it works
Enter RGB
Type R, G, B values (0–255 each). Add an optional Alpha (0–1) for RGBA.
Convert
Each channel is converted to a 2-digit HEX string. Alpha is scaled to 0–255 and appended for RGBA.
Copy
Click the HEX output to copy — with or without the # prefix, uppercase or lowercase.
About this format
RGB to HEX conversion is one of the most common color operations in web development. Design tools export colors as HEX (#FF5733). CSS accepts both, but HEX is shorter and more compact in stylesheets. When your JavaScript canvas code, server-side template, or design system produces RGB integer values, this converter gives you the HEX equivalent in one click.
The conversion works by taking each RGB channel (0–255), converting it to a two-digit hexadecimal string, and concatenating them with a # prefix. Red 255 → FF, Green 87 → 57, Blue 51 → 33 → #FF5733. Values below 16 are zero-padded to maintain the two-digit format (Red 9 → 09, not just 9).
RGBA values with an alpha channel convert to 8-digit HEX. The alpha is normalized from the 0–1 CSS range to the 0–255 integer range and appended as a hex pair. rgba(255, 87, 51, 0.5) → #FF57337F (7F = 127, approximately half of 255).