About RGB to HEX
RGB to HEX rewrites a decimal rgb() color as a hexadecimal string. Type rgb(79, 70, 229) and it hands back #4F46E5 — the form most design tools, palette generators and analytics platforms ask for.
Each channel is clamped into the 0 to 255 range, converted to base 16 and padded to two digits, then the three pairs are joined behind a hash. The result is upper-cased for readability, though CSS treats #4F46E5 and #4f46e5 as the same color. Because the tool reuses the general color parser, the input does not have to be rgb() at all — hsl(243, 76%, 59%) or the word indigo would produce an equally valid answer.
One limitation follows from the output format itself: hex has no alpha channel, so transparency is not represented. A value that arrives with an alpha component is converted on its red, green and blue channels alone.
How to use RGB to HEX
- 1 Enter the color as an rgb() or rgba() value — or, more loosely, as any supported notation.
- 2 The uppercase hex string updates instantly, without a submit step.
- 3 Copy the #RRGGBB value into a palette, a design token file or a stylesheet.
Frequently asked questions
Can I paste an hsl() value instead of rgb()?
Yes. The shared parser handles hex, rgb(), hsl() and a set of named colors, so any of those inputs yields a hex result. The tool is named after its most common use rather than a restriction.
Why are the letters uppercase?
For readability in screenshots and code review. CSS is case-insensitive for hex colors, so #4F46E5 and #4f46e5 render identically.
What happens to out-of-range channels?
They are clamped. A value such as rgb(300, -10, 128) is pulled into 0 to 255 rather than being rejected, which keeps the output a valid color.
Can it output a short hex like #abc?
No — this tool always emits the full six-digit form. If a color happens to collapse to a shorthand, the Hex Shorthand tool will compress it for you.
Free, online, and private
Free to use
RGB to HEX is completely free. There is no account to create, no login, and no hidden charge or usage limit.
Runs online in your browser
It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.
Your data stays private
All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.
How RGB to HEX behaves in detail
These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.
| Parameter | Value |
|---|---|
| Output | uppercase 6-digit #RRGGBB, never the three-digit shorthand |
| Accepted input | rgb() and rgba() with commas, spaces or slashes between the numbers, plus hex, hsl() and named colours through the same shared parser |
| Channel handling | each channel is rounded to a whole number and clamped to 0-255 before the hex digits are built |
| Fractional channels | allowed — rgb(79.6, 70, 229) rounds the first channel up to 80 |
| Update mode | live |
Compiled from the implementation of this tool and checked against it by itoolnet.
What RGB to HEX does not do
Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.
- The shorthand form is never produced: a value like #ffffff stays six digits and no 8-digit form is emitted even when the input carried an alpha figure, so this page cannot normalise a stylesheet to its shortest form.
- Alpha is parsed and then dropped. rgba(255, 0, 0, 0.5) and rgb(255, 0, 0) come back as the same #FF0000, with nothing in the output to show that the transparency was discarded.
- Channels outside the valid span are silently clamped rather than reported, so rgb(300, -5, 0) converts to #FF0000 exactly as if it had been typed that way, and a slip in one channel never surfaces as an error.
Tested and documented by itoolnet, the team that builds and maintains this site.