Search tools

Color guides

8-Digit Hex Colors (#RRGGBBAA): Alpha Opacity Table & CSS Guide

An 8-digit hex code adds two alpha digits at the end (#RRGGBBAA). Get the 0% to 100% hex opacity table, avoid Android's byte-order bug, and check WCAG contrast.

3D sculptural stack of four beveled optical plates stepping from opaque matte teal to frosted sea-glass and crystal-clear glass over a dark slate studio backdrop

An 8-digit hex color is a standard 6-digit #RRGGBB code with two extra hex digits at the end for opacity (#RRGGBBAA). Those last two digits range from 00 (fully transparent) to FF (fully opaque).

That is why 50% opacity is 80, not 50. Hex uses base 16 on a 0 to 255 scale, so half of 255 rounds to 128, which is 80 in hexadecimal (#2F6F6880).

To compute any alpha suffix in JavaScript, multiply the percentage by 255 and convert to base 16:

const alphaHex = (percent) =>
  Math.round((percent / 100) * 255)
    .toString(16)
    .toUpperCase()
    .padStart(2, "0");

alphaHex(50); // "80"
alphaHex(80); // "CC"

You can paste any 8-digit hex code or rgb() alpha string into our color converter to inspect its HEX + alpha value alongside CSS Color 4 syntax and OKLCH.

Hex alpha opacity lookup table (0% to 100%)

Bookmark these common percentages for badges, modal backdrops, and soft borders. Each decimal value matches Math.round((percent / 100) * 255):

Opacity Decimal (0-255) Hex Suffix (AA) Example (#2F6F68 + AA)
100% 255 FF #2F6F68FF
95% 242 F2 #2F6F68F2
90% 230 E6 #2F6F68E6
85% 217 D9 #2F6F68D9
80% 204 CC #2F6F68CC
75% 191 BF #2F6F68BF
70% 179 B3 #2F6F68B3
60% 153 99 #2F6F6899
50% 128 80 #2F6F6880
40% 102 66 #2F6F6866
30% 77 4D #2F6F684D
25% 64 40 #2F6F6840
20% 51 33 #2F6F6833
15% 38 26 #2F6F6826
10% 26 1A #2F6F681A
5% 13 0D #2F6F680D
0% 0 00 #2F6F6800

CSS also supports a 4-digit #RGBA shorthand. Just like 3-digit hex, each character doubles (#2688 expands to #22668888, or 53.3% opacity).

8-digit-hex-color-alpha-transparency-css-diagram

The #RRGGBBAA vs #AARRGGBB trap (CSS vs Android and Flutter)

Web and mobile platforms put the alpha byte on opposite ends of the string. Copying an 8-digit hex token straight from CSS into an Android XML file or Flutter widget silently shifts every channel and produces the wrong color.

  • CSS, SVG, and Figma CSS export (#RRGGBBAA): Alpha comes last.
  • Android XML, Jetpack Compose, and Flutter (#AARRGGBB): Alpha comes first.
/* Web CSS: #RRGGBBAA (alpha byte 80 at the end) */
.chip {
  background-color: #2f6f6880;
}
<!-- Android XML: #AARRGGBB (alpha byte 80 at the start) -->
<color name="chip_bg">#802F6F68</color>
// Flutter / Dart: 0xAARRGGBB (alpha byte 80 at the start)
const chipBg = Color(0x802F6F68);

If you share design tokens across web and mobile apps, store opaque hex plus a decimal opacity (0.5), or emit platform-specific formats during your build step. Our guide on HSL vs Hex in CSS covers when readable functional formats beat raw hex codes in shared stylesheets.

How alpha hex breaks WCAG contrast on text

Translucent text rarely looks as dark as you expect. Before drawing a pixel, the browser composites your foreground over the surface behind it using out = fg * alpha + bg * (1 - alpha).

Take ToolQuilt’s dark ink #16191D over a white #FFFFFF page. Solid #16191DFF scores a rock-solid 17.63:1, but dropping alpha for “muted” secondary labels kills readability fast:

Alpha Token Opacity Rendered Color on #FFFFFF WCAG 2.2 Ratio Body Text (4.5:1)
#16191DFF 100% #16191D 17.63:1 Pass (AAA)
#16191DB3 70% #5B5E60 6.55:1 Pass (AA)
#16191D99 60% #737577 4.62:1 Pass (AA)
#16191D80 50% #8A8C8E 3.39:1 Fail
#16191D66 40% #A2A3A5 2.53:1 Fail

At 50% opacity (#16191D80), even near-black text drops to 3.39:1, failing WCAG AA body text. Colored accents fall off even faster: #2F6F68 passes at 5.84:1 opaque, yet drops to 3.81:1 at just 80% opacity (#2F6F68CC).

Always test translucent text directly over its real card or surface background in our WCAG contrast checker, which composites #RRGGBBAA values before scoring WCAG 2.2 and APCA. You can read how those thresholds work in our WCAG contrast ratio guide.

When to use CSS Color 4 slash syntax instead of 8-digit hex

Static 8-digit hex codes work great for fixed one-off values, but they break down once you introduce CSS custom properties. You can’t append 80 to a variable (var(--brand)80 is invalid CSS).

For themeable surfaces, hover washes, and focus rings, use CSS relative color syntax or color-mix() instead:

:root {
  --brand: #2f6f68;
}

/* CSS Color 4 slash syntax for fixed RGB values */
.overlay {
  background: rgb(47 111 104 / 0.5);
}

/* Relative color syntax: apply alpha directly to any CSS variable */
.badge {
  background: rgb(from var(--brand) r g b / 0.15);
}

/* Broad fallback for dynamic opacity with CSS variables */
.badge-compat {
  background: color-mix(in srgb, var(--brand) 15%, transparent);
}

8-digit hex colors FAQ

Why is 50% opacity 80 in hex instead of 50?

Hex alpha channels store an 8-bit integer from 0 to 255 (00 to FF), not 0 to 100. Half of 255 is 127.5, which rounds to 128, or 80 in base 16 (8 * 16 + 0). Writing 50 in hex actually means 80 / 255, or 31.4% opacity.

Do all modern browsers support 8-digit hex colors?

Yes. Chrome (62+), Firefox (49+), Safari (10+), and Chromium Edge (79+) all support #RRGGBBAA and #RGBA natively. You only need an rgba() fallback if you still support Internet Explorer 11.

Should I use 8-digit hex or opacity in CSS?

Use 8-digit hex (or rgb(... / alpha)) when you only want the background or border to be translucent. Setting the CSS opacity property fades the entire element, including its child text and icons.

Convert any 8-digit hex value into CSS Color 4, OKLCH, or RGBA with the ToolQuilt color converter.

Read next