WorkingFigures

Converters

RGB to hex converter

Paste an rgb() or rgba() value and read the hex equivalent, with a live preview swatch. Everything runs in your browser, and the other notations are one click away below.

⇄
Hex
#11aaff

Text is processed by your own browser and never leaves your device: this page has no server to send it to.

How it works

Each channel from 0 to 255 is written as two hex digits, so rgb(17, 170, 255) becomes #11aaff. Percentages are scaled to 255 first, and an alpha channel is appended as a fourth pair (0.5 becomes 80). Out-of-range channels are clamped rather than rejected.

Frequently asked questions

Can I paste just the numbers, without rgb()?

Yes. A bare triplet like 17, 170, 255 is read the same way; separators can be commas or spaces. hsl() input is also accepted and converted through RGB.

How does alpha end up in hex?

The 0 to 1 alpha is scaled to 0 to 255 and appended as a fourth pair of digits: rgba(17, 170, 255, 0.5) becomes #11aaff80.

Why did my value of 300 turn into ff?

Channels only exist from 0 to 255, so anything outside is clamped to the nearest bound, matching what browsers do when parsing CSS colors.

Other text tools