Convert CSS hex alpha to Android ARGB
Move the alpha byte from the end of a CSS hex color to the front of an Android color resource. Check the result with a translucent blue test swatch.
Read the eight-digit hex value in pairs
For a translucent blue, CSS #33669980 splits into red 33, green 66, blue 99 and alpha 80. The alpha byte is hexadecimal: 80 represents 128 out of 255, or about 50% opacity. The other three bytes describe the color before it is composited onto a background.
Write the Android color resource
Move the last pair to the front and keep the red, green and blue pairs in order. Pasting the CSS value unchanged would give Android an alpha of 33 and a red channel of 66. The result would change in both opacity and hue.
XML<resources>
<color name="overlay_blue">#80336699</color>
</resources>Verify with a light and a dark surface
Draw the same swatch over white and black on both platforms. If it disappears on both surfaces, check for an alpha of 00. For an opaque control, compare CSS #336699FF with Android #FF336699. If the opaque colors agree but the translucent pair differs, check the backgrounds and any additional view opacity.
Tools featured in this guide
Related formats
Frequently asked questions
How do I convert four-digit CSS hex to Android?
Expand each digit first. CSS #3698 becomes #33669988, which becomes #88336699 in Android XML.
Do six-digit colors need rearranging?
A six-digit hex value specifies opaque red, green and blue in both formats. Only move a pair when the source includes an alpha channel.
Authoritative Specifications & References
More color guides
- Repair a GIMP GPL palette that imports emptyRepair a GIMP GPL palette by checking its header and RGB rows. Use a two-swatch reference file to isolate missing colors and verify the imported values.
- W3C Design Tokens (DTCG 2025.10): Figma Variables to CSSStructure vendor-neutral color tokens with W3C DTCG 2025.10 JSON ($type, $value colorSpace & components), aliases, and export to CSS & Tailwind v4.
- Converting Adobe .ASE, .ACO, Procreate .swatches & GIMP .gplLearn the binary differences between Adobe .ase, Photoshop .aco, Procreate .swatches ZIP, and GIMP .gpl — and convert between them locally in the browser.
- Hex to OKLCH: Migrating Design Tokens to Tailwind CSS v4Step-by-step guide to upgrading Hex and HSL Tailwind v3 themes into CSS Color 4 @theme oklch() scales with perceptual brightness and Display P3 support.