RGB to HEX Converter
Convert colours between RGB and HEX: rgb(255, 0, 0), 255,0,0, percentage channels, #f00, #ff0000 and #ff0000ff are all accepted, with uppercase, short-hex and alpha controls plus line-by-line batch conversion.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Accepts rgb()/rgba(), percentage channels, bare numbers, #f00, #ff0000, #ff0000ff, plus hsl()/hsv()/cmyk().
Result
One result per line, ready to paste into CSS.
Enter a colour to see the result
What this tool does
- Paste rgb()/rgba() values from a design file and get hex codes you can drop straight into CSS.
- Clean up a palette in bulk: one colour per line in, one result per line out.
- Check translucent colours: the 8-digit hex and rgba() form are shown together so the alpha byte cannot drift.
Example
Input
rgb(51, 102, 153)
Output
#336699
Percentage and bare-number channels agree: rgb(20%, 40%, 60%) and 51,102,153 both give #336699.
Frequently asked questions
Which input notations are supported?
rgb()/rgba() with 0–255 or percentage channels, bare numbers like 255,0,0, #f00 / #f00a / #ff0000 / #ff0000ff, plus hsl(), hsv()/hsb(), cmyk() and device-cmyk(). Percentage channels follow CSS Color 4 rounding: 50% → 128.
How is alpha handled?
By default it follows the input: with alpha you get #RRGGBBAA and rgba(), without it #RRGGBB and rgb(). You can force alpha on or off; the hex alpha byte is round(alpha × 255) with a configurable number of decimals (3 by default).
Why does #336699 become #369 in short mode?
CSS allows collapsing a hex colour whose digit pairs repeat into 3 or 4 digits (#ff0000 → #f00). Every pair in #336699 repeats, so it collapses too. Short output is off by default to avoid losing information.
How many colours can I convert at once?
Input is processed line by line with no line limit. Blank lines are skipped and failing lines are reported individually below the result without breaking the rest.
Keywords:rgbargb2hexrgb to hexhex to rgbcolor converter