HEX to Flutter Color Converter
Convert any HEX color into Flutter's Color(0xAARRGGBB) format. Control opacity, generate MaterialColor swatches, and copy Dart constants ready to paste into your app.
MaterialColor swatch (50–900)
Click any swatch to copy its Flutter Color value. 500 is the base shade, matching your input.
Material 3 tonal palette
These are the tones Flutter generates internally for ColorScheme.fromSeed(seedColor: Color(0xFF...)). Each value is the OKLCH-lightness tone of your seed hue.
Saved colors
What is a HEX to Flutter color converter?
A HEX to Flutter color converter translates a standard sRGB HEX code into the 32-bit ARGB integer that Flutter and Dart expect: Color(0xAARRGGBB). It also generates MaterialColor swatches (50–900), ColorSwatch<int> maps, Dart const declarations, withValues opacity snippets, and Material 3 tonal palettes. Every output is copy-ready and matches Flutter's own color conventions, so you can paste the result directly into a widget, theme, or design-system file.
Key takeaways
- Flutter uses 0xAARRGGBB — alpha first, then red, green, blue.
- #FF0066 becomes
Color(0xFFFF0066). Fully opaque is the default. - Lower the opacity slider to change the AA byte — from 0x00 to 0xFF.
- withValues(alpha: 0.5) replaces
withOpacityin Flutter 3.27+. ColorScheme.fromSeedbuilds a Material 3 scheme from one seed color — the tonal palette tab shows what Flutter generates.
How to use the HEX to Flutter color converter
- Enter your HEX colorType a 3-digit or 6-digit HEX code, or pick from the swatch. Any valid sRGB HEX works: #FF0066, #f06, #1E90FF.
- Set alpha / opacityDrag the opacity slider from 0 (fully transparent) to 100 (fully opaque). The Flutter color updates live — alpha becomes the top byte of 0xAARRGGBB.
- Copy the Flutter ColorThe main output is Color(0xAARRGGBB). Tap to copy. This is the exact form Flutter's Color constructor expects.
- Pick a code formatSwitch tabs to get Color, MaterialColor swatches (50–900), ColorSwatch, Dart const declarations, or withValues opacity snippets. Each is copy-ready.
- Check Material 3 tonal valuesThe Material 3 tab shows the tonal palette around your color — the same family Flutter uses for Material 3 theming with ColorScheme.fromSeed.
- Export or saveCopy the full Dart file, Tailwind (for Flutter web apps sharing a design system), or JSON. Save your favorites and share via URL.
Understanding Flutter's 0xAARRGGBB format
Flutter's Color constructor accepts a single 32-bit integer. The bytes are laid out from most significant to least significant as alpha, red, green, and blue:
| Byte | Bits | Range | Meaning |
|---|---|---|---|
| AA | 24–31 | 0x00 – 0xFF | Alpha — 00 = transparent, FF = opaque |
| RR | 16–23 | 0x00 – 0xFF | Red channel |
| GG | 8–15 | 0x00 – 0xFF | Green channel |
| BB | 0–7 | 0x00 – 0xFF | Blue channel |
So #FF0066 becomes Color(0xFFFF0066) at full opacity, and Color(0x80FF0066) at 50% opacity. This is why Flutter developers often convert from CSS HEX by simply prepending FF — but this tool handles the alpha channel, swatches, and tonal palettes for you.
Flutter color formats — which one should you use?
| Format | Type | Use it when |
|---|---|---|
| Color(0xAARRGGBB) | Single color | A specific color value in a widget, style, or inline widget property. |
| const Color(...) | Compile-time constant | The color never changes. Flutter optimizes const colors and avoids rebuilds. |
| MaterialColor(primary, {shades}) | Swatch of 10 shades | ThemeData.primarySwatch, custom ColorScheme, or a brand palette. MaterialColor exposes shade50 through shade900 and .shade500 as the base. |
| ColorSwatch<int>(primary, {map}) | Arbitrary named map | A design-system color set with your own keys — like 100, 200, or light, main, dark. More flexible than MaterialColor. |
| ColorScheme.fromSeed | Full Material 3 theme | You want Flutter to generate every Material 3 color (primary, secondary, surface, outline, error) from one seed. The tonal palette tab shows the internal tones. |
Opacity in Flutter — the modern approach
For years, Flutter developers used color.withOpacity(0.5). Starting with Flutter 3.27, withOpacity is deprecated in favor of withValues, which handles wide-gamut color spaces and per-channel overrides correctly:
// Old (deprecated in Flutter 3.27+) Color(0xFFFF0066).withOpacity(0.5); // New (recommended) Color(0xFFFF0066).withValues(alpha: 0.5); // Full override Color(0xFFFF0066).withValues(alpha: 0.8, red: 200);
If you're supporting Flutter below 3.27, keep withOpacity. The tool generates both snippets so you can copy whichever your project needs.
MaterialColor swatches in Flutter
MaterialColor is a subclass of ColorSwatch<int> that contains ten color variants (50, 100, 200, ..., 900) plus a primary shade. It is what you pass to ThemeData.primarySwatch or a custom ColorScheme before Material 3. The 500 shade is normally the primary value.
const MaterialColor brand = MaterialColor(
0xFFFF0066,
<int, Color>{
50: Color(0xFFFFE5F0),
100: Color(0xFFFFB8D9),
200: Color(0xFFFF8AC0),
300: Color(0xFFFF5CA6),
400: Color(0xFFFF2E8D),
500: Color(0xFFFF0066),
600: Color(0xFFE6005C),
700: Color(0xFFCC0052),
800: Color(0xFFB30048),
900: Color(0xFF99003D),
},
);
The tool generates these shades using a perceptually-correct lightness ladder based on your base hue, so the swatch feels balanced rather than an arbitrary tint ladder.
Material 3 and ColorScheme.fromSeed
Material 3 shifts Flutter theming from a hand-authored palette to a seed-based tonal palette. Pass one seed color, and Flutter derives every role automatically:
ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFFFF0066),
brightness: Brightness.light,
),
useMaterial3: true,
);
Flutter internally computes tones at fixed lightness levels (0, 10, 20, ..., 100) using the Google Material Color Utilities. The Material 3 tonal palette tab in this tool shows a preview of those tones using OKLCH lightness, so you can see roughly which tones Flutter will pick for primary, onPrimary, primaryContainer, and the rest.
How Flutter handles HEX from CSS, Figma, or Adobe XD
Design tools all output sRGB HEX or 8-digit HEX with alpha. Flutter expects ARGB, so the leading 2 digits must be the alpha, not the red. Two patterns cover almost every case:
- 6-digit HEX (e.g.,
#FF0066) — prependFFto getColor(0xFFFF0066). The tool does this automatically. - 8-digit HEX (e.g.,
#80FF0066in CSS RGBA order) — reorder toColor(0x80FF0066). Flutter takes alpha first.
When you copy the 8-digit HEX from Figma's color panel, its order is RRGGBBAA. Flutter expects AARRGGBB. This tool detects 8-digit input and swaps the channels for you.
Flutter color in React Native, iOS, and Android
The same HEX is universal. For cross-platform apps, you often need the color expressed four different ways:
| Platform | Format | Example |
|---|---|---|
| Flutter | Color(0xAARRGGBB) | Color(0xFFFF0066) |
| Android XML | #AARRGGBB | #FFFF0066 |
| iOS / SwiftUI | UIColor(red:green:blue:alpha:) | UIColor(red: 1, green: 0, blue: 0.4, alpha: 1) |
| React Native | 'rgba(r,g,b,a)' | 'rgba(255,0,102,1)' |
| Web / CSS | #RRGGBB | #FF0066 |
Common Flutter color mistakes
- Forgetting the alpha byte.
Color(0xFF0066)is not the same asColor(0xFFFF0066). The first one has alpha 0x00 (fully transparent) and is nearly invisible. - Passing 8-digit HEX in CSS order. Figma gives
#FF0066FF, not#FFFF0066. Reorder the channels before pasting into Flutter. - Using withOpacity in new code. It is deprecated since Flutter 3.27. Use
withValues(alpha: ...). - Hand-authoring MaterialColor swatches. Use the generated swatch — hand-authored shades are almost always perceptually uneven.
- Ignoring Material 3. If your app uses
useMaterial3: true, useColorScheme.fromSeedrather than hand-setting primary and secondary.
Frequently asked questions
What is a HEX to Flutter color converter?
A HEX to Flutter color converter translates a standard sRGB HEX code into the format Flutter and Dart expect: Color(0xAARRGGBB). It handles the alpha channel, opacity, MaterialColor swatch generation, ColorSwatch maps, and Material 3 tonal palettes, so you can copy directly into a Flutter widget.
How do I use a HEX color in Flutter?
Convert the HEX to a 32-bit ARGB integer and pass it to Color(). For example, #FF0066 becomes Color(0xFFFF0066). For partial transparency, replace the leading FF with the alpha byte. This tool does that conversion for you and generates the constant.
What is 0xAARRGGBB in Flutter?
0xAARRGGBB is a 32-bit hexadecimal integer where AA is the alpha channel (00 = transparent, FF = opaque), RR is red, GG is green, and BB is blue. Flutter's Color constructor accepts this exact format. It is the standard way to define colors in Dart and Flutter.
What is the difference between Color and MaterialColor?
Color is a single 32-bit color value. MaterialColor is a subclass of ColorSwatch that contains ten color variants (50, 100, 200, …, 900) plus a primary shade. You use MaterialColor when you need a full palette tied to a single primary color — for example, as ThemeData.primarySwatch or a custom ColorScheme.
What is a ColorSwatch in Flutter?
ColorSwatch<T> is an immutable map of Color values keyed by a value type (usually int). It is the base class MaterialColor extends. Use ColorSwatch when you want named color variants — for example, a brand palette with keys like 100, 500, 900 or "light", "main", "dark".
How do I add opacity to a Flutter color?
In older Flutter versions, use color.withOpacity(0.5). Since Flutter 3.27, withOpacity is deprecated in favor of color.withValues(alpha: 0.5). The tool generates both, so you can use whichever your Flutter version supports.
How do I create a Material 3 color scheme from a HEX color?
Use ColorScheme.fromSeed(seedColor: Color(0xFF...)) in your ThemeData. Flutter builds a full Material 3 color scheme from one seed. The Material 3 tab in this tool shows the tonal palette that Flutter generates internally, so you can see the primary, secondary, tertiary, surface, and outline tones before writing the code.
What is the difference between withOpacity and withValues?
withOpacity(double opacity) returns a copy with the given opacity (0–1). It is deprecated in Flutter 3.27+. withValues({double? alpha}) is the modern replacement and accepts alpha, red, green, blue, and colorSpace overrides. Use withValues for new code and withOpacity only if you need compatibility with Flutter below 3.27.
Can I use a Flutter color with Tailwind?
Flutter web apps sometimes share design tokens with a Tailwind CSS app. The tool exports a Tailwind v4 @theme block using the same HEX so both codebases stay in sync. Tailwind itself does not consume Dart colors; you sync them via the shared HEX or JSON token file.
Why does Flutter show a slightly different color from CSS?
Flutter renders colors using the device's display color space. On P3-capable displays, Flutter uses Display P3 for wide-gamut rendering (since 3.10). CSS sRGB hex values are converted into P3 by Flutter, so the color is nearly identical, but there can be tiny differences at gamut edges. For pixel-exact match, use the same color space throughout.
How do I convert a Flutter Color back to HEX?
Use color.toARGB32().toRadixString(16).padLeft(8, "0") to get the ARGB hex string, then take the last six characters for RGB. Or use value.toRadixString(16) on older Flutter (value is deprecated in 3.27+). This tool lets you paste a Color(0x...) value back to get the HEX, but for automated conversion you can also check the reverse conversion in the code snippets.
Does this tool work for React Native, Android, or iOS colors?
The HEX is universal. For Android XML, use #AARRGGBB. For iOS UIColor, use UIColor(red:green:blue:alpha:). For React Native, use "rgba(r,g,b,a)" or an ARGB integer. The HEX and RGB shown in this tool give you everything you need for those targets.
Is the HEX to Flutter color converter free?
Yes. The converter is completely free, requires no account, and runs entirely in your browser. Nothing you enter leaves your device.