CHROMA

RGB to HEX Converter

Type a RGB value and get HEX straight away. Everything runs in your browser — nothing is sent to a server.

Result

Other formats

HOW

How the conversion works

Each RGB channel (0–255) becomes two hexadecimal digits, padded with a leading zero when needed, then joined together. 255 becomes FF and 9 becomes 09.

RGB

RGB describes color the way a screen makes it: three lights added together, each from 0 to 255. All three at zero is black; all three at 255 is white. Because it mirrors the hardware it is exact and lossless, but it is hard to reason about — nudging a color slightly warmer means changing two or three numbers at once with no obvious direction.

HEX

HEX is the same red-green-blue triplet as RGB, just written in base 16 so each channel fits in two characters. It survives everywhere — CSS, design tools, config files — because it is short and unambiguous. Case does not matter, and #abc is shorthand for #aabbcc. An eight-digit HEX adds alpha as a final pair, which is why #FF000080 is half-transparent red.

STEPS

RGB to HEX, step by step

Worked through with #FF6347. Every number comes from the same engine the converter above uses.

  1. Write each channel in base 16 R 255 = 15×16 + 15 → FF G 99 = 6×16 + 3 → 63 B 71 = 4×16 + 7 → 47
  2. Join them up # + FF + 63 + 47 = #FF6347
EXAMPLES

RGB to HEX examples

ColorRGBHEX
Red rgb(255, 0, 0) #FF0000
Tomato rgb(255, 99, 71) #FF6347
Orange rgb(255, 165, 0) #FFA500
Gold rgb(255, 215, 0) #FFD700
Limegreen rgb(50, 205, 50) #32CD32
Teal rgb(0, 128, 128) #008080
Dodgerblue rgb(30, 144, 255) #1E90FF
Royalblue rgb(65, 105, 225) #4169E1
Blueviolet rgb(138, 43, 226) #8A2BE2
Hotpink rgb(255, 105, 180) #FF69B4
FAQ

Common questions

Why do single digits get a leading zero?

Every channel must occupy exactly two characters or the string becomes ambiguous. Red 9 is 09; writing 9 would shift every digit after it and change the color entirely.

My RGB has decimals — what happens to them?

They are rounded to the nearest whole number first, because HEX has no way to store a fraction. rgb(127.6 0 0) becomes #800000, and converting back gives you 128, not 127.6.

Should I write the letters in upper or lower case?

Either — they are the same color to every browser and tool. Pick one and stay consistent so diffs in version control stay readable.

MORE

Other converters