Convert RGB to HEX
Convert RGB values to a hex colour code.
RGB to HEX Converter
Developer tool running locally in browser
What does RGB to HEX Converter do?
Convert red, green and blue values into a hexadecimal colour code, with sliders as well as numeric entry. Alpha is supported and produces the 8-digit hex form.
How to Use RGB to HEX Converter
- 1Set the RGB valuesDrag the sliders or type numbers 0–255.
- 2Read the hex codeIt updates as you adjust.
- 3Copy the codeWith or without the leading hash.
Key Features
- Sliders and numeric fields for each channel
- Alpha channel producing 8-digit hex
- Live colour swatch
- Shorthand 3-digit form offered when the value allows it
- Accepts a pasted rgb() or rgba() string
Frequently Asked Questions
How do I convert RGB to hex by hand?
Convert each channel to a two-digit hexadecimal number and concatenate. 79 is 4F, 70 is 46, 229 is E5, giving #4F46E5.
Why are RGB values limited to 255?
Because each channel is stored in one byte, giving 256 levels from 0 to 255. Three channels of 256 levels produce 16,777,216 possible colours.
Can every RGB colour be written as 3-digit hex?
No. Shorthand only works when both digits of each pair are the same, so #FF8800 shortens to #F80 but #FE8800 cannot shorten at all.
How is alpha represented in hex?
As a fourth pair of digits, from 00 (transparent) to FF (opaque). An alpha of 0.5 is 128, which is 80 in hex.
Input is processed in your browser and never transmitted. That said, treat any web page as untrusted for live production secrets — rotate anything you paste anywhere.
Related Tools
HEX to RGB Converter
Convert a hex colour code to RGB values.
Colour Converter
Convert between HEX, RGB, HSL, HSV and CMYK.
RGB to HSL Converter
Convert RGB values to hue, saturation and lightness.
HSL to RGB Converter
Convert hue, saturation and lightness to RGB and hex.
