RGB to Hex Converter
Enter red, green, and blue values with an optional alpha and copy the matching HEX, 8-digit HEX, and HSL, next to a live swatch.
Each channel is 0 to 255. Everything runs in your browser. Nothing is uploaded.
Formats
How to convert RGB to HEX online
Enter the channels
Type the red, green, and blue values as numbers from 0 to 255 in the three fields.
Set alpha if needed
Drag the alpha control to add transparency, or leave it at 100% for a fully opaque color.
Read the codes
The HEX, 8-digit HEX, RGB, and HSL forms and a live swatch update instantly as you change any value.
Copy what you need
Use the copy button on any row, or Copy all formats to grab every notation in one block.
Why use this tool
Separate channel fields
Red, green, and blue each get their own input, so you can nudge one value and watch the swatch and every code update at once.
HEX and 8-digit HEX together
The standard #RRGGBB code sits beside the #RRGGBBAA form that folds the alpha value into the last two digits.
Alpha carried into every form
The transparency slider flows into the 8-digit HEX, the rgba() string, and the hsla() output, so semi-transparent colors stay correct.
Values clamped and rounded
Channels outside 0 to 255 are clamped and decimals are rounded, so the output is always a valid color code.
Runs entirely in your browser
Everything happens on your device; nothing is uploaded, sent to a server, or stored.
About this tool
This converter turns red, green, and blue channel values into a HEX color code. Enter each channel as a number from 0 to 255, drag the optional alpha control, and the HEX, 8-digit HEX with alpha, RGB, and HSL forms update instantly next to a live swatch. Every value has its own copy button. Channels outside the 0 to 255 range are clamped, and decimals are rounded to the nearest whole channel, so the output is always a valid color code you can paste straight into CSS.
Reach for it whenever a design tool hands you raw RGB numbers but your stylesheet, config file, or icon export wants a HEX string. The alpha channel becomes the last two digits of an 8-digit HEX value and the fourth argument of an rgba() or hsla() string, which is handy for semi-transparent overlays and shadows. Because the three channels stay as separate fields, you can adjust one value at a time and watch the swatch shift, rather than editing a single packed string by hand.
Everything is computed in the page, so the numbers you enter are never sent anywhere. Color work rarely stops at one conversion: to read a HEX or RGB value back as every other notation use the color converter, to check a text and background pairing against WCAG rules try the contrast checker, and to build a set of tints and shades from your color open the color shades generator.
Frequently asked questions
- How do I convert RGB to a HEX code?
- Enter the red, green, and blue values from 0 to 255 and the HEX code appears immediately. Each channel is written as a two-digit hexadecimal number and joined into a #RRGGBB string.
- What is the 8-digit HEX output?
- An 8-digit HEX value, #RRGGBBAA, adds the alpha channel as a final pair of digits. It lets a single HEX string carry transparency, which is supported in CSS and most modern design tools.
- What happens if I enter a value above 255?
- Any channel below 0 or above 255 is clamped to that range, and decimal values are rounded to the nearest whole number, so the result is always a valid 24-bit color.
- Can I get an HSL value too?
- Yes. The same color is shown as hsl(), and as hsla() when the alpha is below 100%, alongside the RGB and HEX forms. Each row has its own copy button.
- Is my data uploaded anywhere?
- No. Everything runs in your browser; nothing is sent to a server or stored.
Related tools
Color Converter
Type or pick a color and get HEX, RGB, HSL, HSV, and CMYK side by side, with a live swatch preview.
Contrast Checker
Check the WCAG contrast ratio between two colors and see which AA and AAA levels pass.
Color Shades Generator
Build a tint and shade scale from one base color and copy the numbered steps.
Analogous Color Generator
Turn any base color into a three swatch analogous palette by rotating its hue.
Aspect Ratio Calculator
Solve the missing width or height for any aspect ratio, from 16:9 to a custom shape.
CSS Box Shadow Generator
Dial in a CSS box-shadow with live preview and copy the exact code.