Turn RGB into HEX and back.
Two simple converters in one page. Type numbers or a code, copy the result, and learn how the conversion works.
1. RGB to HEX
Have three numbers? Turn them into a HEX code.
2. HEX to RGB
Have a HEX code? Turn it into three numbers.
58134255Quick reference
A few common colors. Tap one to load it into both converters.
How to use this tool (step by step)
Small steps, each with the reason behind it. Perfect for beginners, and a handy checklist for experts.
Convert RGB to HEX
- Look at the left box (RGB to HEX).
- Move the R, G and B sliders, or type numbers from 0 to 255.
- Read the HEX code on the right of the preview and press Copy.
Why we do this: RGB describes a color with three numbers (red, green, blue). Many websites and design tools want the same color written as a HEX code instead.
Convert HEX to RGB
- Look at the right box (HEX to RGB).
- Type or paste the HEX code. The # sign is optional, and short codes such as F80 work too.
- Read the three numbers or press Copy to take the full rgb(...) text.
Why we do this: Some programs, such as image editors and spreadsheets, ask for red, green and blue separately.
Read the math (optional)
- Look at the dotted box below each result.
- Each line shows how one color channel is turned into two HEX characters.
- Try changing a number and watch the math change.
Why we do this: Seeing the steps shows that HEX is not magic. It is just the same three numbers written in base 16.
Fix a mistake
- If the box turns red, read the message under it.
- A HEX code has exactly 3 or 6 characters: the digits 0-9 and the letters A-F.
- Remove any extra spaces or letters, and try again.
Why we do this: Computers cannot guess what you meant, so the code must follow the rules exactly.
Questions people ask
Quick answers.
What does HEX mean?
HEX is short for hexadecimal, a number system with 16 digits: 0-9 and A-F. A HEX color has 6 characters: two for red, two for green and two for blue.
Why is the biggest RGB number 255?
Each channel is stored in one byte, which can hold 256 values (0 to 255). In HEX, 255 is written FF.
Are rgb(255, 0, 0) and #FF0000 the same color?
Yes. They are two ways to write exactly the same red.
What is a 3-digit HEX code?
It is a short form where each character is doubled. #F80 means #FF8800.