Skip to content
hexcolorcodepicker.com

8-Digit HEX Codes and Transparency

What is an 8-digit HEX code?

An 8-digit HEX code is a 6-digit color code plus a fourth pair for alpha, which sets transparency. The form is #RRGGBBAA, where AA runs from 00 for fully transparent to FF for fully solid. The code #3B82F680 is the blue #3B82F6 at 50 percent opacity.

The first 3 pairs work exactly as in a normal HEX code: RR is red, GG is green, and BB is blue. The fourth pair does not add a color; it sets how much of the color shows and how much of the background shows through. A code with no alpha pair is fully solid by default, so #3B82F6 and #3B82F6FF are the same color. CSS, design tools, and most pickers accept the 8-digit form.

#3B82F680

Alpha 80 means 50% opacity: 128 of 255. Tap the alpha block to slide it from 00 to FF.

The alpha table: from solid to invisible

The alpha table maps opacity to a hex pair: 100% is FF, 75% is BF, 50% is 80, 25% is 40, and 0% is 00. Each pair is the opacity times 255, rounded to the nearest whole number, so 75 percent of 255 is 191, which is BF in hex.

Read the table when you need a common opacity and do not want to calculate it. The values are rounded, so 50 percent gives 128, which is 80, not 7F, and 25 percent gives 64, which is 40. A 1-point rounding difference is invisible to the eye, so the table values are safe to use as written. For an exact opacity, multiply the percent by 255, round it, and convert the result to hex as in our RGB to HEX conversion guide.

Worked examples

#3B82F6 at 50 percent opacity is #3B82F680, which is rgba(59, 130, 246, 0.5). The color pairs are 3B (59), 82 (130), and F6 (246), as explained in what is a HEX color code. The alpha pair for 50 percent is 80, because 50 percent of 255 is 127.5, rounded to 128, and 128 in hex is 80. The rgba() form uses 0.5 for the same opacity.

#FF5733 at 75 percent opacity is #FF5733BF, which is rgba(255, 87, 51, 0.75). The color pairs are FF (255), 57 (87), and 33 (51), as explained in what is a HEX color code. The alpha pair for 75 percent is BF, because 75 percent of 255 is 191.25, rounded to 191, and 191 in hex is BF (11 × 16 + 15).

OpacityDecimalAlpha pair8-digit code
100%255FF
75%191BF
50%12880
25%6440
0%000

Tap a row to copy its 8-digit code. Shown: #3B82F680 at 50% over a checkerboard.

RGBA and HSLA: the same idea in other forms

RGBA and HSLA add the same transparency as the alpha pair, written as a decimal from 0 to 1. The code #3B82F680 is rgba(59, 130, 246, 0.5) and hsla(217, 91%, 60%, 0.5). The color numbers stay the same; only the alpha writing changes.

In rgba(), the fourth number is the opacity as a decimal: 1 is solid, 0.5 is half transparent, and 0 is invisible. In hsla(), the same decimal goes after the hue, saturation, and lightness. The hex alpha pair and the decimal are the same value in two forms: 80 in hex is 128 in decimal, and 128 divided by 255 is 0.5. Older browsers support rgba() more widely than 8-digit HEX, so rgba() is safer for code that must work everywhere.

#3B82F680

rgba(59, 130, 246, 0.5)

hsla(217, 91%, 60%, 0.5)

Change the opacity slider: all 3 cards update at once — 80, 0.5, and 0.5 are the same transparency.

The 4-digit shorthand with alpha: #RGBA

A 4-digit HEX code is the short form with alpha: #RGBA expands to #RRGGBBAA by doubling each digit. The code #F008 becomes #FF000088, which is red at about 53 percent opacity, because 8 doubles to 88, which is 136, and 136 divided by 255 is 0.53.

The doubling rule is the same as in our 3-digit HEX codes guide, with one extra digit at the end for alpha. The code #FFF0 expands to #FFFFFF00, which is white at 0 percent opacity, so it is invisible. The code #FFFF expands to #FFFFFFFF, which is solid white. Four-digit codes are rare in real code, but they follow the same rule as 3-digit codes, so they are easy to read once you know the rule.

Opacity: about 53% (136 of 255).

Each digit doubles into its pair; the swatch updates over a checkerboard.

AARRGGBB: the alpha-first form

AARRGGBB is the same 8 digits with alpha first instead of last, used by Android and Flutter. The blue #3B82F6 at 50 percent opacity is #803B82F6 in AARRGGBB form, because the alpha pair 80 moves from the end to the front. The color pairs stay in the same order.

Android and Flutter code often writes colors as 0x803B82F6 or Color(0x803B82F6), where the first 2 digits after 0x are alpha. That is the only difference from #RRGGBBAA: the alpha pair is first, not last. Mixing the two forms is a real bug, because #803B82F6 in web form would mean a different color with an alpha of F6. Always check which form a platform expects before you paste a code, and convert by moving the alpha pair, not by retyping the color.

#3B82F680

Web form #RRGGBBAA — alpha last.

3B82F680

The alpha pair moves from the end to the front; the color pairs stay in the same order.

Seeing transparency: the checkerboard preview

Transparency is shown on a checkerboard, because a plain white background hides it. A half-transparent blue on white looks like a lighter blue, but on a checkerboard you can see the gray squares showing through. Always preview a transparent color on a checkerboard, not on white.

A transparent color blends with whatever is behind it, so its look changes with the background. The code #3B82F680 on white looks like a pale blue, on black it looks like a dark blue, and on a photo it tints the photo. That is why the Hex Color Code Picker shows transparency on a gray-and-white checkerboard: the pattern makes the blend visible. When you test a transparent color for text, test it on its real background, because the contrast changes with the background.

Checkerboard

White

Black

One slider updates all 3 previews at once — the background changes the color.

When to use transparency

Use transparency for overlays, hover states, shadows, and disabled states, where the background should show through. A half-transparent black overlay dims a photo without hiding it, and a half-transparent button shows its hover state without a second color. Use a solid color when the background must not show through.

Transparency is best when one element sits on top of another and both should stay visible. It is a poor choice for body text, because the contrast depends on the background and can fail on some backgrounds. It is also a poor choice for print, because printers and PDFs handle transparency differently from screens. For a color that must look the same everywhere, pick a solid color instead of a transparent one over a fixed background.

Photo dimmed by a half-transparent black overlay

Overlay: #00000080 — a half-transparent black overlay dims a photo without hiding it.

Frequently asked questions

The last 2 digits are the alpha pair, which sets transparency. FF means fully solid, 00 means fully transparent, and 80 means about half transparent. The first 6 digits are the color, exactly as in a normal HEX code.