Calculator
What the RGB to HEX Converter does
RGB to HEX Converter: converts HEX from Red, Green and Blue. Formula: Each colour channel is one byte: #RRGGBB, where RR, GG and BB are 00-FF (0 to 255 decimal). Example: red 37, green 99 and blue 235 gives HEX #2563eb.
The RGB to HEX Converter takes Red, Green and Blue and returns HEX. Edit a field and the answer updates in place.
Typical users are anyone checking a colour for legibility. Contrast failures are the most common accessibility problem on the web, and the easiest to fix.
There is no back end here. The calculation runs where you are sitting, not on a server somewhere.
Further down the page: what each field expects, how the result is derived, and one example worked from the defaults.
What do the RGB to HEX Converter fields mean?
The RGB to HEX Converter uses 3 inputs. Each input has a default that makes sense on its own, so a partial edit still gives a valid result.
| Field | What to enter | Default |
|---|---|---|
| Red | accepts 0 to 255 | 37 |
| Green | accepts 0 to 255 | 99 |
| Blue | accepts 0 to 255 | 235 |
How does the RGB to HEX Converter work?
Conversion is exact in both directions. Hex is just base-16 notation for the same three numbers.
Validation is deliberately strict: silently coercing a bad value is how wrong numbers get trusted.
Worked example
These are the values the RGB to HEX Converter loads by default, and the result it produces from them. Here is the calculation as it stands the moment the page loads.
| Red | 37 |
|---|---|
| Green | 99 |
| Blue | 235 |
| HEX | #2563eb |
|---|
Read next: Colour Contrast and WCAG: The Ratio, the Thresholds, What They Miss
How to use it
- Put Red (0 to 255).
- Key in Green (0 to 255).
- Fill in Blue (0 to 255).
- The tool reacts immediately rather than waiting for you to finish the form.
- The results panel then shows HEX.
- Copy Link is the quickest way to send the exact scenario to someone else.
What this tool does not do
- Conversions between colour spaces with different gamuts are approximate at the edges.
- Colours render differently across displays; the values are exact but the appearance is not guaranteed.
- It cannot detect a typo that happens to fall inside the valid range.
- Check that each figure is in the unit the label asks for; that is the most common source of a wrong result.
Frequently asked questions
Only Red, Green and Blue. Nothing starts empty, which means a single edit is enough to get a meaningful answer.
Red accepts 0 to 255. Values outside that range are rejected with a message naming the field, rather than producing something that looks valid but is not.
With the values loaded when the page opens, HEX comes out as #2563eb. Any edit re-runs the calculation, so there is no stale number on screen.
No. Disconnect from the internet and it still works; that is the simplest proof there is no server call.
Nothing at all. There is no registration, no paywall and no per-use quota.
It matches what you would get working it out by hand, with fewer opportunities to slip.