HEX ↔ RGB Converter
Convert colors between HEX and RGB formats.
🔒 Runs entirely in your browser — nothing is uploaded.
How HEX ↔ RGB Converter works
How does the HEX/RGB conversion work?
Typing a hex code parses it with parseInt(hex, 16) and bit-shifts out the red, green, and blue byte values. Editing any of the R, G, or B number fields runs the reverse: each value is clamped to 0-255 and converted back to a two-digit hex pair with toString(16), then joined into a hex string.
When is this conversion useful?
It comes up when a design tool gives you a hex color but your CSS needs an rgb() value, or the other way around, or when you just need to confirm two different color notations refer to the same color.
Does it accept shorthand hex codes like #fff?
No - the validation regex requires exactly six hex digits, so 3-digit shorthand notation is rejected with an error asking for the full 6-digit form. Expand #fff to #ffffff before pasting it in.