Skip to content

ARGB Color Picker and Converter

Pick or paste a colour, set its opacity, and copy it for Android, Flutter, Compose or CSS.

Click the circle to pick

8-digit hex is

Opacity to hex alpha

The alpha pair is the opacity as a number from 0 to 255, written in hex. The last two columns use the colour picked above. Android and Flutter put the pair first, CSS puts it last.

OpacityAlpha (0 to 255)Hex pairAndroid #AARRGGBBCSS #RRGGBBAA
100%255FF#FFFF8800#FF8800FF
95%242F2#F2FF8800#FF8800F2
90%230E6#E6FF8800#FF8800E6
85%217D9#D9FF8800#FF8800D9
80%204CC#CCFF8800#FF8800CC
75%191BF#BFFF8800#FF8800BF
70%179B3#B3FF8800#FF8800B3
65%166A6#A6FF8800#FF8800A6
60%15399#99FF8800#FF880099
55%1408C#8CFF8800#FF88008C
50%12880#80FF8800#FF880080
45%11573#73FF8800#FF880073
40%10266#66FF8800#FF880066
35%8959#59FF8800#FF880059
30%774D#4DFF8800#FF88004D
25%6440#40FF8800#FF880040
20%5133#33FF8800#FF880033
15%3826#26FF8800#FF880026
10%261A#1AFF8800#FF88001A
5%130D#0DFF8800#FF88000D
0%000#00FF8800#FF880000

About HEX, ARGB and RGBA colours

Web colours are written most often as a hexadecimal triplet (#FF8800) or as an RGB function (rgb(255, 136, 0)). Both describe the same three channels of the sRGB colour space, red, green and blue, each from 0 to 255. Hex is what designers paste from Figma and what most stylesheets contain; RGB makes the channel values explicit, which is what Canvas, SVG scripting and colour maths need.

This page takes a colour from your browser's native picker or from any common notation you paste, lets you set its opacity, and writes it out for Android XML (#AARRGGBB), Flutter and Jetpack Compose (Color(0xAARRGGBB)), CSS (#RRGGBBAA, rgba() and hsl()) and as plain six-digit hex. Everything runs in your browser.

Anatomy of a hex colour

#RRGGBB is three pairs of hex digits, each pair running from 00 (0) to FF (255). #FF8800 is red 255, green 136, blue 0: a saturated orange. Letters are case-insensitive, so #ff8800 and #FF8800 are the same colour. The three-digit shorthand #F80 expands by doubling each digit to #FF8800. Two-digit values such as #F8 are not a shorthand at all. CSS Color Level 4 added #RRGGBBAA and #RGBA, where the last pair is alpha, so #FF880080 is the same orange at 50% opacity. The browser's colour dialog always returns an opaque six-digit value, so the opacity on this page comes from the slider or from an alpha value you paste in.

Converting by hand and in code

Split the hex string after the # into pairs and parse each pair as a base-16 integer. Going the other way, convert each channel to hex and pad to two digits (0 becomes 00, not 0).

// JavaScript
const [r, g, b] = ['FF', '88', '00'].map(h => parseInt(h, 16));   // 255, 136, 0
const hex = '#' + [255, 136, 0].map(c => c.toString(16).padStart(2, '0')).join('');
# Python
r, g, b = (int('ff8800'[i:i+2], 16) for i in (0, 2, 4))
/* CSS: the same colour four ways */
color: #ff8800;
color: rgb(255 136 0);            /* modern space-separated syntax */
color: rgb(255 136 0 / 50%);      /* with alpha */
color: rgb(from var(--brand) r g b / 50%);  /* relative colour syntax */

HSL: the model people reason in

RGB is how screens work, not how designers think. HSL expresses a colour as hue (0 to 360 degrees around the colour wheel), saturation (0% grey to 100% vivid) and lightness (0% black to 100% white). #FF8800 is hsl(32, 100%, 50%). A hover state that is "the same colour, a little darker" is hsl(32 100% 42%), which is much easier to derive than a new hex value. To convert from RGB, scale each channel to 0 to 1, take the maximum and minimum channel values, then lightness is (max + min) / 2, saturation is (max - min) / (1 - |2L - 1|), and hue depends on which channel is largest: 60 times (G - B) / (max - min) when red leads, plus 120 degrees when green leads or 240 when blue leads. This page shows the HSL form of the picked colour next to the other notations.

Android, Flutter and Compose: alpha comes first

Android colour resources accept #RGB, #ARGB, #RRGGBB and #AARRGGBB. The alpha pair leads, the reverse of CSS. Flutter's Color and Jetpack Compose's Color take the same order as one 32-bit number, written 0xAARRGGBB. Leave the alpha out of a Flutter value and you get 0x00RRGGBB, which is fully transparent, so always write the FF for an opaque colour.

<!-- Android: res/values/colors.xml -->
<color name="brand">#FFFF8800</color>
<color name="brand_50">#80FF8800</color>
// Flutter
const brand50 = Color(0x80FF8800);
// Jetpack Compose
val Brand50 = Color(0x80FF8800)
/* CSS: the same colour, alpha last */
color: #FF880080;

The four-digit forms have the same trap: Android reads #8F80 as alpha 88 then FF8800, while CSS reads #F808 for that colour. When you paste an eight-digit or four-digit value above, choose which order it is written in. Values that start with 0x or Color( are always read alpha first.

Contrast and accessibility

WCAG defines contrast from relative luminance. Each channel is scaled to 0 to 1 and linearised (divided by 12.92 when at or below 0.04045, otherwise ((c + 0.055) / 1.055) ^ 2.4), then luminance is 0.2126 R + 0.7152 G + 0.0722 B. The contrast ratio between two colours is (L1 + 0.05) / (L2 + 0.05) with the lighter colour on top. The thresholds that matter:

RequirementMinimum ratio
Body text, level AA4.5 : 1
Large text (18 pt, or 14 pt bold), level AA3 : 1
Body text, level AAA7 : 1
Icons, form borders and other UI components (WCAG 2.1, 1.4.11)3 : 1

Worked example: #FF8800 on white is about 2.4 : 1, which fails for text of any size, while the same orange on black is about 8.8 : 1 and passes AAA. Mid greys are the classic trap: #777777 on white is 4.48 : 1 and fails AA by a hair, whereas #767676 is 4.54 : 1 and passes.

Colour must not be the only signal

Roughly 1 in 12 men and 1 in 200 women have a red-green colour vision deficiency, so a red-versus-green status dot conveys nothing to them. Pair colour with an icon, a label or a pattern. Chrome DevTools can emulate the common deficiencies from the Rendering panel, which is the quickest way to check a palette.

Where hex and rgb fit in a design system

  • CSS custom properties. Store the brand colour once, --brand: #ff8800;, and derive variants with color-mix(in srgb, var(--brand) 80%, black) or the relative colour syntax shown above instead of hard-coding a second hex.
  • Canvas and SVG. ctx.fillStyle and SVG fill accept either notation; scripts that animate a colour usually keep the RGB numbers and format them as needed.
  • Android. Android XML uses #AARRGGBB with alpha first, so a CSS #FF880080 (orange at 50%) pasted into Android becomes a fully opaque colour with a different hue. Flutter and Compose follow the same ARGB order: Color(0xFFFF8800).
  • iOS. UIColor and SwiftUI take channels as floats from 0 to 1, so 136 becomes 136 / 255, about 0.533.
  • Tailwind. Arbitrary values accept hex directly: bg-[#ff8800].

Colour values are not personal data, but the page still runs entirely in your browser. For embedding small graphics next to your colours, see the image to Base64 tool.

How to use

  1. Click the round swatch to open your browser or operating system colour picker and choose a colour visually.
  2. Or paste a colour into the box: #FF8800, #F80, #80FF8800, Color(0x80FF8800), rgb(255, 136, 0) or rgba(255, 136, 0, 0.5).
  3. For an eight-digit or four-digit hex value, choose whether it is written alpha first (Android, Flutter) or alpha last (CSS).
  4. Move the opacity slider to set transparency. Every output and the opacity table update at once.
  5. Use the copy button next to the notation you need: Android XML, Flutter and Compose, CSS hex with alpha, HEX, RGBA or HSL.

Common use cases

  • Converting a hex colour from a design file into RGB numbers for a Canvas, SVG or WebGL fill.
  • Reading the exact channel values of a brand colour before deriving a darker hover state.
  • Checking whether two hex values that look alike are actually identical.
  • Reordering a CSS colour for Android, Flutter or Compose, where alpha comes first.
  • Finding the hex alpha pair for an opacity, such as 80 for 50% or CC for 80%.
  • Picking a flat colour for a chart series or button without opening a design tool.

Frequently asked questions

Which colour format should I use in CSS?

Hex is compact and universally supported for opaque colours. Use rgb() when you need alpha or want to derive colours with the relative colour syntax, and hsl() when designers will adjust lightness or saturation by hand. All of them describe the same sRGB colour.

How does HEX map to RGB?

A six-digit hex code is three pairs of two hex digits, one per channel, each from 00 (0) to FF (255). #FF8800 is red 255, green 136 (0x88) and blue 0. The page performs that base-16 to base-10 conversion for you.

Is #F80 the same as #FF8800?

Yes. Three-digit hex is shorthand in which each digit is doubled, so #F80 expands to #FF8800. Two- or four-digit forms are not valid shorthands, except that #RGBA is the short form of #RRGGBBAA.

What is #AARRGGBB?

It is the eight-digit hex order Android uses: alpha first, then red, green and blue. #80FF8800 is orange at 50% opacity. Flutter and Jetpack Compose use the same order as a number, Color(0x80FF8800). CSS uses the other order, #FF880080.

What hex value is 50% opacity?

80. Half of 255 is 127.5, which rounds to 128, and 128 in hex is 80. So orange at 50% is #80FF8800 in Android and #FF880080 in CSS. The opacity table on this page lists every step of 5%.

Does the tool support HSL, HWB or OKLCH?

It shows HSL, and HSLA when the colour is transparent, next to the other notations. HWB, LAB and OKLCH are not covered. Browser DevTools can convert a colour through those spaces by shift-clicking the swatch in the Styles panel.

How do I add transparency?

Move the opacity slider. The page then writes the colour with its alpha in every notation: #80FF8800 for Android, Color(0x80FF8800) for Flutter and Compose, #FF880080 and rgba(255, 136, 0, 0.5) for CSS.

What contrast ratio does text need?

WCAG level AA requires at least 4.5:1 for normal text and 3:1 for large text (18 pt, or 14 pt bold); AAA raises those to 7:1 and 4.5:1. Icons and control borders need 3:1 against their background.

Why does the colour picker look different in another browser?

The dialog is drawn by your browser and operating system, not by this page. Chrome, Firefox, Safari and Edge all return the same six-digit hex value, so the result is identical even though the picker is not.

Why does a colour with alpha look wrong when pasted into Android?

Android and Flutter place the alpha pair first (#AARRGGBB), whereas CSS places it last (#RRGGBBAA). Paste the CSS value above, choose #RRGGBBAA (CSS), and copy the Android XML or Flutter output.

advertisement