RGB to HEX Converter
Convert RGB or RGBA values to HEX color codes instantly. Enter channels manually or paste an rgb() string, preview the swatch and copy the HEX result.
Result
What is the RGB to HEX Converter?
The RGB to HEX Converter turns red, green and blue channel values (0–255) into a hexadecimal color code you can drop straight into CSS or a design tool.
- Converts RGB and RGBA to 6- or 8-digit HEX
- Paste an rgb() string to auto-fill the channels
- Live color swatch preview
- Alpha channel support
- One-click copy
- Runs entirely in your browser
How to use the RGB to HEX Converter
- 1
Enter the R, G and B values (0–255), and optionally alpha (0–1).
- 2
Or paste a full rgb()/rgba() string into the parse field.
- 3
Check the live swatch to confirm the color.
- 4
Click Copy to grab the HEX code.
About the RGB to HEX Converter
The RGB to HEX Converter turns red, green and blue channel values (0–255) into a hexadecimal color code you can drop straight into CSS or a design tool. Add an alpha value below 1 and the tool produces the 8-digit HEX form as well.
You can type the channels into separate fields or simply paste a whole rgb(255, 102, 0) or rgba(255, 102, 0, 0.5) string — the tool parses it automatically and fills in the values. A live swatch confirms the color before you copy the code.
All conversion math runs locally in your browser. No values are uploaded, no sign-up is needed, and it works offline.
Frequently asked questions
How do I convert RGB to HEX manually?
Convert each channel from decimal to base 16 and pad to two digits. For rgb(255, 102, 0): 255 = ff, 102 = 66, 0 = 00, so the HEX code is #ff6600. Values below 16 need a leading zero, e.g. 10 becomes 0a.
How is alpha represented in a HEX code?
Alpha becomes the last two digits of an 8-digit HEX code. Multiply the alpha by 255 and convert to hex: 0.5 × 255 ≈ 128 = 80, so rgba(255, 102, 0, 0.5) is #ff660080. This tool does that rounding for you.
What is the valid range for RGB values?
Each channel goes from 0 (none of that color) to 255 (full intensity). Values outside that range are clamped. 0,0,0 is black, 255,255,255 is white, and equal channels always produce a shade of gray.
Can I paste an rgb() string instead of typing each value?
Yes. Paste anything like rgb(12, 34, 56), rgba(12,34,56,0.4) or even the modern space-separated rgb(12 34 56 / 40%) form, and the converter extracts the channels automatically.
Why does my 8-digit HEX look wrong in an old browser?
8-digit HEX with alpha was added in CSS Color Level 4 and is supported in all evergreen browsers, but very old browsers (like IE11) ignore it. For legacy support use the rgba() form instead — both values are shown here.
Guides for RGB to HEX Converter
Related tools
HEX to RGB Converter
Convert HEX color codes to RGB and RGBA instantly. Supports 3, 6 and 8-digit HEX with a live color swatch, batch list conversion and one-click copy.
HSL to HEX Converter
Convert HSL values to HEX and RGB with live hue, saturation and lightness sliders. Watch the color swatch update in real time and copy the color codes.
Color Picker
Pick any color and get its HEX, RGB and HSL values instantly. Free online color picker with shades, tints and one-click copy for designers and developers.
Color Palette Generator
Generate complementary, analogous, triadic, tetradic and monochromatic color palettes from any base color. Click any swatch to copy its HEX code fast.