RGB to Hex color converter
Convert an RGB color (rgb(255, 136, 0)) to its hex equivalent (#ff8800). The reverse-direction math, worked examples, and a live tool.
# conversion
| format | foreground | background |
|---|---|---|
| rgb | rgb(255, 136, 0) | rgb(0, 0, 0) |
| hex | #ff8800 | #000000 |
| hsl | hsl(32, 100%, 50%) | hsl(0, 0%, 0%) |
# context
RGB is explicit and CSS-friendly; hex is shorter and lives in design files. Converting back is base-10 → base-16 per channel, zero-padded to two digits, concatenated with a leading #.
→ Open in color picker (pre-filled)
# notes
- rgb(255, 136, 0) → 255→ff, 136→88, 0→00 → #ff8800.
- Zero-pad each channel: rgb(0, 5, 16) → #000510 (not #0516).
- Browsers accept both forms in CSS — preference is yours. Hex is more compact; rgb() lets you use percentage-based channels.