Last updated: 2026-06-19
RGB to Hex Color Converter
Turn R, G, B values into a hex color code instantly.
An RGB to hex converter turns red, green, and blue channel values (each 0–255) into a six-digit hex color code like #00FF80. Hex color codes are the standard way to specify colors in CSS and HTML. Enter your R, G, and B values below to get the hex code.
How to convert RGB to hex
- Enter the Red, Green, and Blue values (each from 0 to 255).
- The hex color code appears instantly in the Hex color field.
- Use the copy button to paste it into your CSS or design tool.
Worked example: rgb(0, 255, 128)
Each channel is converted to two hex digits: 0 → 00, 255 → ff, 128 → 80. Joined together they form #00ff80.
Reference table
| Color | RGB | Hex |
|---|---|---|
| Black | 0, 0, 0 | #000000 |
| White | 255, 255, 255 | #ffffff |
| Red | 255, 0, 0 | #ff0000 |
| Green | 0, 128, 0 | #008000 |
| Blue | 0, 0, 255 | #0000ff |
| Yellow | 255, 255, 0 | #ffff00 |
| Orange | 255, 165, 0 | #ffa500 |
| Gray | 128, 128, 128 | #808080 |
Frequently asked questions
- How do I convert RGB to hex?
- Convert each channel (0–255) to a two-digit hexadecimal number, then join them in red-green-blue order with a leading #. This tool does it instantly.
- What is rgb(255, 0, 0) in hex?
- rgb(255, 0, 0) is #ff0000, which is pure red.
- Why are hex color codes six digits?
- Each of the three channels (red, green, blue) needs two hex digits to cover the range 0–255, so 3 × 2 = 6 digits.
- Can I use hex colors in CSS?
- Yes. Hex codes like #00ff80 are a standard color format in CSS and HTML.