Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Use this free online tool to convert RGB color values to HEX color values, which can be used to specify colors in HTML and CSS. Enter your red, green, and blue values into this tool to get the corresponding hexadecimal code. The tool is developed by TestMu AI and is completely free to use.
Red
Green
Blue
Hex
RGB and HEX are two ways of describing the same color, a red, green, and blue value. RGB writes the color as three numbers from 0 to 255, while HEX writes it as a code built from the digits 0-9 and the letters A-F (base 16). HEX values are commonly used in coding, for instance in HTML and CSS files.
Both notations describe the exact same set of roughly 16.7 million colors, so converting between them never changes the color itself, only how it is written. If you need to go the other way, the HEX to RGB converter reverses the process.
Converting a color takes only a few seconds and everything runs in your browser, with nothing to install. Follow these steps:
The converter takes the three input values for Red, Green, and Blue, each a decimal (base 10) number from 0 to 255, and turns every channel into a two-character hexadecimal (base 16) value. Joining the three pairs in order produces the final #RRGGBB code used in HTML and CSS.
To convert a channel by hand, divide its value by 16. The quotient becomes the first hex digit and the remainder becomes the second, using the mapping 10=A, 11=B, 12=C, 13=D, 14=E, and 15=F. For example, 255 divided by 16 is 15 remainder 15, which gives FF, so rgb(255, 165, 0) becomes FF, A5, and 00, or the HEX code #FFA500 (orange).
A hex color code is not always six digits. Depending on the format, it can be 3, 6, or 8 characters long:
Use this quick reference table to look up the HEX code for common colors. Each RGB value (Red, Green, Blue) maps to a 6-digit hexadecimal code you can paste straight into your HTML or CSS. Most design tools and color pickers display these HEX codes alongside their RGB values.
| Color | RGB value | HEX code |
|---|---|---|
| Black | rgb(0, 0, 0) | #000000 |
| White | rgb(255, 255, 255) | #FFFFFF |
| Red | rgb(255, 0, 0) | #FF0000 |
| Green | rgb(0, 255, 0) | #00FF00 |
| Blue | rgb(0, 0, 255) | #0000FF |
| Yellow | rgb(255, 255, 0) | #FFFF00 |
| Cyan | rgb(0, 255, 255) | #00FFFF |
| Magenta | rgb(255, 0, 255) | #FF00FF |
RGB to HEX conversion comes up anywhere design values and code meet, since design tools often report RGB while stylesheets standardize on HEX. Here are the workflows where the converter saves the most time:
The conversion runs entirely in your browser, so no color data is sent to a server. The tool is maintained by TestMu AI and is completely free, with no signup and no usage limits.
No. While the full form uses six digits, hex color codes also come in a 3-digit shorthand (for example, #F00 is the same as #FF0000) and an 8-digit form that adds a two-digit alpha channel for transparency (RGBA). So a hex color can be 3, 6, or 8 characters long depending on the format.
In digital systems, data is measured in bits, each holding a 0 or 1. Eight bits grouped together can represent any number from 0 to 255. Because counting starts at 0 rather than 1, the highest value in that 256-step range is 255, so each color channel runs from 0 to 255.
RGB 255, 0, 0 converts to the HEX code #FF0000, which is pure red. The red channel is at its maximum (255 = FF) while green and blue are both 0 (00).
The hex code #000000 is equal to rgb(0, 0, 0), which is black. Every channel is set to 0, meaning no red, green, or blue light is added.
A value with four numbers is an RGBA color, where the fourth number is the alpha (transparency) channel. 255, 255, 255, 255 is white at full opacity, written as #FFFFFFFF in 8-digit hex.
RGB defines a color using red, green, and blue values. RGBA adds a fourth value, the alpha channel, which sets how transparent the color is, from 0 (fully transparent) to 255 (fully opaque).
Hex codes use both. Because they are written in base 16, each digit can be 0-9 or the letters A-F, where A=10 and F=15. That is how values above 9, such as FF for 255, are represented.
Did you find this page helpful?
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance