The hex color expander converts CSS shorthand hex codes into their full-length form. The 3-digit shorthand (#RGB) is a compact way to write certain colors, but tools, gradients, and color math usually need the full 6-digit #RRGGBB form. This tool doubles each digit to expand it instantly.
How it works
A hex color channel is a byte written as two hex digits, 00–ff. Shorthand works because some colors have channels where both digits are identical, like ff or 33. In that case CSS lets you write the single digit once, and the browser expands it by duplicating each digit:
#f0c → #ff00cc
f → ff
0 → 00
c → cc
The same rule extends to the 4-digit form with an alpha channel: #f0c8 → #ff00cc88. Expansion is purely textual — each of the 3 (or 4) digits is repeated to form the long code, and the resulting color is identical.
Notes
- Only colors with repeated-digit channels can be written in shorthand, which is why shorthand offers just 16 values per channel.
- The leading
#is optional in this tool; it is added back to the output. - The live swatch lets you confirm the expanded color looks right.
Everything runs locally in your browser — your input is never uploaded.