Enter channels in 0–255
CSS accepts both 0–255 integers and percentages; this converter uses the integer convention. Values outside the range are clamped, and decimals round to the nearest integer because hex cannot represent fractions of a channel.
Convert rgba() or rgb() values into hex — six digits when opaque, eight digits when transparent — with a live swatch and copy-ready output.
Alpha below 1 produces the 8-digit #RRGGBBAA form; exactly 1 produces the shorter #RRGGBB.
All color math runs locally in this browser tab. Nothing is sent to a server.
CSS accepts both 0–255 integers and percentages; this converter uses the integer convention. Values outside the range are clamped, and decimals round to the nearest integer because hex cannot represent fractions of a channel.
An alpha of 0.5 becomes 80 in hex (128 of 255). Exactly 1.0 drops the alpha digits entirely, because #RRGGBB is the compact, universally supported spelling for opaque colors.
A hex value can differ from an rgba value by one unit per channel because of rounding. When matching a design-system color exactly, prefer the format the source used.
#RRGGBBAA — the last two digits encode alpha from 00 (transparent) to FF (opaque). Every modern browser supports it; IE 11 does not.
For current browsers, yes. If you must support very old browsers, keep rgba() for anything transparent and hex only for opaque colors.
Hex alpha has 256 steps while decimal alpha is continuous. 0.5 rounds to 0x80 = 128/255 ≈ 0.502. The difference is invisible but real.
Yes. The converter parses strings like rgba(198, 240, 100, 0.5) as well as the individual number fields.
Pick a category to see every tool in it — then open one and discover related tools.