toolfree

RGB to HEX

Convert RGB values to a hex colour code in your browser, in both the old and modern CSS syntaxes.

Runs in your browser

Enter a colour.

Both CSS syntaxes are accepted

rgb(184, 56, 15) is the old comma-separated form. rgb(184 56 15) is the modern space-separated one, and rgb(184 56 15 / 50%) is how alpha is written now — the slash replaces the separate rgba() function, which still works but is no longer necessary.

Both are read here, so paste whatever your tooling produced.

Why hex at all

RGB and hex carry exactly the same information. Hex persists because it is shorter, unambiguous and copy-pasteable: #b8380f survives being written on a whiteboard, pasted into a chat message and typed back in, where rgb(184, 56, 15) acquires stray spaces and loses brackets.

For anything a human types by hand rather than a program generates, hex is usually the better format.

Values out of range

Channels are clamped to 0–255. A value of 300 becomes ff, not a wrapped number — which is what CSS does too, and is safer than the alternative: wrapping turns a slightly-too-bright colour into a completely different one.

Nothing is uploaded

Converted in this page.