Blog
Unit converters

RGB to HEX converter

Enter the red, green and blue channel values (0 to 255 each) and the converter assembles them into a #RRGGBB HEX color code, showing a live swatch of the resulting color.

Your data never leaves this device

Result

HEX code

This page has no server side at all. The table you paste is parsed by JavaScript inside your own browser, the chart is drawn on a canvas element on your machine, and the export file is assembled locally. Nothing is uploaded, stored or written to any log. You can disconnect from the network after the page has loaded and everything will still work — which is the simplest way to verify the claim yourself.

Facts and limits of this method

Each channel's range 0 to 255 inclusive
Result format #RRGGBB — six hexadecimal digits, uppercase letters
Rounding Fractional channel values are rounded to the nearest integer
Out-of-range values Values below 0 or above 255 are automatically clamped to those bounds

When it misleads you

How it is calculated

Each of the three values (red, green, blue) is rounded to the nearest integer and clamped to the 0–255 range.

Each clamped value is converted to a two-digit hexadecimal number: for example, 59 in decimal is "3b" in hexadecimal.

The three resulting character pairs are joined in order with a leading "#" — producing a full HEX code like #3B82F6.

The swatch is filled directly with that same HEX code via CSS, so it visually matches the result.

Questions and answers

What happens if I enter a number above 255?

It's automatically clamped to 255 — no error, the channel just becomes maximally bright.

Can I enter fractional channel values?

Yes, but they're rounded to the nearest integer before conversion to HEX — the final color is always described by whole numbers from 0 to 255.

Does the result account for transparency?

No, this converter only handles opaque colors. For an alpha channel, use the separate RGBA to HEX converter.

Is my data sent anywhere?

No, the whole calculation runs in your browser.

Related tools

All tools