Developer
Encoders, converters & dev utilities
RGB to HEX Color Converter
Convert RGB channels like rgb(255, 136, 0) into a CSS HEX color. Each channel is a number 0–255, and HEX writes that byte as exactly two base-16 digits (00–ff), zero-padded, then concatenates them as #RRGGBB. Worked example: rgb(255, 136, 0) → 255 = FF, 136 = 88, 0 = 00 → #FF8800. A channel below 16 needs the leading zero — rgb(5, 0, 0) is #050000, not #500. Alpha maps to a fourth pair: rgba(255, 136, 0, 0.5) → alpha 0.5 × 255 ≈ 128 = 80 → #FF880080. It all runs in your browser with a live swatch and copy-ready CSS — nothing is uploaded. Free, no login.
RGB → HEX = write each channel as two zero-padded base-16 digits and join: #RRGGBB
- Byte-exact worked example: rgb(255, 136, 0) → 255=FF, 136=88, 0=00 → #FF8800
- Zero-padding matters: rgb(5, 0, 0) → 05 00 00 → #050000 (never drop the leading zero)
- Alpha: rgba(255, 136, 0, 0.5) → round(0.5×255)=128=80 → #FF880080 (8-digit CSS Color 4 hex)
- 100% client-side with a live swatch + copy-ready CSS — the conversion never leaves your browser
Frequently asked questions
How do I convert RGB to HEX?
Convert each of the three channels (0–255) to a two-digit hexadecimal value and join them behind a #. For rgb(255, 136, 0): 255 is FF, 136 is 88, 0 is 00, so the HEX is #FF8800. The key detail is zero-padding — any channel below 16 (0x10) is a single hex digit and must be padded to two, so rgb(5, 0, 0) is #050000. This tool does it live and gives you copy-ready CSS.
How is alpha (rgba) written in HEX?
CSS Color 4 allows an 8-digit HEX #RRGGBBAA where the fourth pair is the alpha channel as a byte. Multiply the 0–1 alpha by 255 and round: 0.5 × 255 ≈ 128, which is 80 in hex, so rgba(255, 136, 0, 0.5) becomes #FF880080. Fully opaque (alpha 1) is FF and can be omitted; fully transparent (alpha 0) is 00.
Why does my HEX have a leading zero like #050000?
Because each channel must occupy exactly two hex digits. The value 5 in hex is just "5", a single digit, so it is zero-padded to "05" to keep the #RRGGBB structure aligned. Dropping the zero would misread the color — #50000 is not a valid 6-digit HEX, and #500 would be the shorthand for #550000, a different color entirely.