RGB to HEX Converter
Enter red, green and blue values (0–255) and get the matching HEX code instantly.
About the RGB to HEX Converter
Enter red, green and blue values (0–255) and get the matching HEX code instantly. Every value is computed locally with vanilla JavaScript — there is no server round-trip, no sign-up and no limit on how many times you use it.
How to use
Enter RGB values
Type the red, green and blue numbers, each from 0 to 255.
See the preview
A live swatch shows the resulting color as you adjust the channels.
Get the HEX code
The matching #RRGGBB value updates instantly below the inputs.
Copy and use
Copy the HEX code with one tap and paste it into your design or stylesheet.
Benefits
Designer-friendly
Move from RGB picker values to a portable HEX code in seconds.
Forgiving input
Out-of-range numbers are clamped to a valid 0–255 range automatically.
No setup
Works instantly in any modern browser with nothing to install.
Features & supported formats
Features
- Three numeric channel inputs
- Live color preview swatch
- Uppercase HEX output
- One-tap copy
- Automatic value clamping
Supported formats
Accuracy & limitations
Going from three channel numbers to a HEX code is exact whenever those numbers are whole and in range; the notes below cover what happens when they are not.
- The conversion is exact for whole-number channels in the 0–255 range.
- Values outside 0–255 are clamped to the nearest valid number, and decimals are rounded to the nearest integer, so the output may not match an out-of-range input.
- Output is uppercase by convention. Lowercase HEX is equally valid and identical to a browser.
- This converter handles opaque colors. For an alpha channel, use the HEX to RGB tool, which reports RGBA.
Frequently asked questions
What range do RGB values use?
Each channel runs from 0 to 255. The converter clamps anything outside that range to the nearest valid value.
Why convert RGB to HEX?
HEX codes are compact and portable, which makes them the most common way to share a single color in CSS and design tools.
Will the HEX be uppercase or lowercase?
The tool outputs uppercase HEX by default, which is purely cosmetic — both forms are valid.
Can I enter decimals?
RGB channels are whole numbers, so values are rounded to the nearest integer before conversion.
Does it handle transparency?
This converter focuses on solid colors; for alpha, use the HEX to RGB tool which shows RGBA.
Further reading
Color Models Explained
What each color model actually measures, where each one is the right choice, and why the same color has six different sets of numbers.
Front-endColor in CSS
Every way CSS lets you write a color, when custom properties beat hard-coded values, and what the newer color functions change.