All the Tools You Need

RGB to Hex Converter | Color Code Converter | RGB to Hexadecimal

RGB to Hex Converter

Convert RGB color values (0‑255) to hexadecimal color codes (#RRGGBB) and vice versa. Live preview.
RGB → Hex
Hex → RGB
R
G
B
Presets
Red
Green
Blue
White
Black
Yellow
Pink
Hex Code
#FF0000
RGB: 255, 0, 0
RGB Decimal
255, 0, 0
CSS Usage
color: #FF0000;
HSL Approx.
0°, 100%, 50%
Color Conversion
Hex = RRGGBB16
Each RGB component (0‑255) converts to two hexadecimal digits.
Example: R=255 → FF, G=0 → 00, B=128 → 80 → #FF0080
Hex to RGB: split into three pairs, convert each from base‑16 to decimal.
People Also Ask
🤔 How do I convert RGB to hex manually?
Divide each RGB value by 16 to get the first hex digit, remainder gives second. Example: 255→15 (F) and 15 (F) → FF.
🔍 What does the # in hex codes mean?
The # prefix indicates the number is in hexadecimal format. It's standard in CSS and HTML.
⚡ Can hex codes be shorthand?
Yes, if each pair has the same digit (e.g., #FF8844 → #F84). Not all colors have shorthand.
📏 What is the range of RGB values?
Each channel (red, green, blue) ranges from 0 to 255 (8‑bit). 0 = no intensity, 255 = full intensity.
🎯 What is the hex code for white?
White is #FFFFFF (all channels max). Black is #000000.
🔥 Why use hex instead of RGB?
Hex is shorter and more compact in CSS. It's also easier to remember certain colors like #FF0000 for red.
About RGB and Hexadecimal Colors

RGB (Red, Green, Blue) is an additive color model used in digital displays. Each color is represented by three numbers from 0 to 255, indicating the intensity of each channel.

Hexadecimal color codes are a compact way to write RGB values in base‑16. Two hex digits per channel (00‑FF) correspond to 0‑255 decimal.

Common conversions
  • Red: rgb(255,0,0) → #FF0000
  • Green: rgb(0,255,0) → #00FF00
  • Blue: rgb(0,0,255) → #0000FF
  • Yellow: rgb(255,255,0) → #FFFF00
  • Magenta: rgb(255,0,255) → #FF00FF
  • Cyan: rgb(0,255,255) → #00FFFF
Quick Color Reference
ColorRGBHex
Black0,0,0#000000
White255,255,255#FFFFFF
Red255,0,0#FF0000
Green0,255,0#00FF00
Blue0,0,255#0000FF
Yellow255,255,0#FFFF00
Magenta255,0,255#FF00FF
Cyan0,255,255#00FFFF
Silver192,192,192#C0C0C0
Gray128,128,128#808080
Maroon128,0,0#800000
Olive128,128,0#808000
Dark Green0,128,0#008000
Purple128,0,128#800080
Common Questions
How do I convert RGB to hex in CSS?
You can use both: background-color: rgb(255,0,0); or background-color: #FF0000;. Most CSS preprocessors have built‑in functions to convert.
What is the difference between #FFF and #FFFFFF?
#FFF is the shorthand for #FFFFFF when each channel has duplicate digits. It's allowed in CSS.
Scroll to Top