Format decision

When to Use 8-Digit HEX in CSS

8-digit HEX is useful because it stores an opaque base color and its transparency in one compact token. The format is not automatically better than RGBA, but it can be helpful when a team wants one reusable string for a repeated UI state.

Where it works well

The format works best when a semi-transparent value is treated like a stable token rather than a one-off experiment. Overlays, selected state fills, subtle shadows, and badge backgrounds are all good examples because the same alpha-enabled color may be referenced across multiple components.

In that situation, storing one value such as `#2563EB33` can be cleaner than repeating a full `rgba(...)` string every time. The token remains compact and easy to copy into documentation or code.

Where it causes confusion

It becomes less helpful when people need to understand the transparency at a glance. Many developers can read a base HEX color quickly, but far fewer can immediately map the last two characters to a mental alpha percentage. If a team is still experimenting with opacity, RGBA is often easier to discuss and review.

Rule of thumb

  • Use 8-digit HEX when the alpha value is stable and will be reused as a token.
  • Prefer RGBA when people still need to discuss, edit, or tune the transparency often.
  • Keep the convention consistent within the same design system layer.
Try it in the converter Compare with RGBA