Convert RGB to HEX, Free
Files convert instantly in your browser. 100% private, any file size, no account needed.
How to convert RGB to HEX
RGB colors are expressed as three integers from 0 to 255, one each for red, green, and blue. Hex colors express the same values in base-16 notation. The conversion is a direct base-10 to base-16 translation for each channel: divide the value by 16 to get the first hex digit, take the remainder as the second. So 255 becomes FF, 128 becomes 80, and 0 becomes 00. The full hex code is a hash symbol followed by the six digits: #RRGGBB.
This converter performs the calculation instantly in your browser. Type any RGB value and the hex code appears immediately. The math is exact with no rounding: every decimal value from 0 to 255 maps to a unique two-digit hex pair. Common use cases include copying hex codes from design tools into CSS, cross-referencing color systems, and building design tokens.
Enter the RGB values
Type the red, green, and blue values each from 0 to 255. For example, rgb(255, 87, 51) is a vivid orange-red color.
Read the hex code
The hex equivalent appears instantly. RGB(255, 87, 51) converts to #FF5733. Each channel is independently converted: 255 -> FF, 87 -> 57, 51 -> 33.
Copy for use in CSS or design tools
Click to copy the hex code. Paste it directly into CSS color properties, Figma color fields, Sketch color pickers, or any tool that accepts hex color codes.
Convert back if needed
To go from hex to RGB, use the hex-to-RGB converter. The reverse calculation takes each two-digit hex pair and converts it from base 16 to base 10.
Frequently asked questions
How do I manually convert RGB to hex?
Take each channel value (0 to 255) and convert it to two-digit hexadecimal. Divide by 16 (floor) for the first digit, take the remainder for the second. Digits above 9 become A (10), B (11), C (12), D (13), E (14), F (15). Then concatenate: # + red hex + green hex + blue hex.
What does shorthand hex (#RGB) mean?
Shorthand hex uses three digits instead of six. Each digit is doubled to get the full value: #F53 expands to #FF5533. Only colors where both hex digits of each channel are identical can use this shorthand.
How do I add alpha (opacity) to a hex color?
CSS supports 8-digit hex codes: #RRGGBBAA. The last two digits represent the alpha channel from 00 (fully transparent) to FF (fully opaque). For example, #FF5733CC is 80 percent opacity orange-red. Browser support for 8-digit hex is universal in modern browsers.
What RGB values correspond to common colors?
Pure red is rgb(255,0,0) = #FF0000. Pure green is rgb(0,255,0) = #00FF00. Pure blue is rgb(0,0,255) = #0000FF. Black is rgb(0,0,0) = #000000. White is rgb(255,255,255) = #FFFFFF.