Zero Signup ToolsFree browser tools

Converter Tools

HEX to Mobile Color Converter

Convert a HEX or RGBA color to SwiftUI, UIColor, NSColor, Jetpack Compose, Android XML, and Flutter code. Correct 0 to 1 floats and alpha order. No signup.

HEX to mobile and native color code converter

Input

Paste a color

Detected input: HEX

Samples

Preview

#3B82F6

Channels

R
59 / 0.231
G
130 / 0.51
B
246 / 0.965
A
255 / 1.0

Each row shows the 0 to 255 byte and the 0.0 to 1.0 float that native APIs expect.

Output

Platform code

SwiftUI Color

Channels are 0.0 to 1.0. Opacity is the 4th argument.

Color(red: 0.231, green: 0.51, blue: 0.965)

UIKit UIColor

iOS. alpha is always required and is 0.0 to 1.0.

UIColor(red: 0.231, green: 0.51, blue: 0.965, alpha: 1.0)

AppKit NSColor

macOS. sRGB initializer, 0.0 to 1.0 channels.

NSColor(srgbRed: 0.231, green: 0.51, blue: 0.965, alpha: 1.0)

Jetpack Compose Color

Android Kotlin. Hex literal is 0xAARRGGBB (alpha first).

Color(0xFF3B82F6)

Android colors.xml

Resource value is #AARRGGBB (alpha first).

<color name="brand">#FF3B82F6</color>

Android Color.parseColor

Kotlin / Java. Also expects #AARRGGBB.

Color.parseColor("#FF3B82F6")

Flutter Color (hex)

Dart. Constructor takes a 0xAARRGGBB int (alpha first).

const Color(0xFF3B82F6)

Flutter Color.fromARGB

Dart. Four 0 to 255 ints, alpha first.

const Color.fromARGB(255, 59, 130, 246)

CSS / Web HEX

Web orders alpha last: #RRGGBBAA.

#3B82F6

CSS rgb() / rgba()

Web. Alpha is 0.0 to 1.0.

rgb(59, 130, 246)

Alpha order matters: CSS writes alpha last (#RRGGBBAA), but Android, Jetpack Compose, and Flutter write alpha first (0xAARRGGBB). This tool already places it correctly for each platform, so copy the row you need without reordering.

How to use

  1. Paste a color: a HEX value with or without a # (use 8 digits like #3B82F6CC for transparency), or an rgb()/rgba() value. Auto detect picks the format, or choose HEX or RGB / RGBA.
  2. Check the live swatch on the checkerboard background to confirm the color and any transparency, and read the Channels panel for the 0 to 255 and 0.0 to 1.0 values.
  3. Find the platform you need: SwiftUI, UIColor, NSColor, Jetpack Compose, Android colors.xml, Android Color.parseColor, Flutter hex, or Flutter fromARGB.
  4. Click Copy on that row to grab the exact code, or use Copy all to get one commented block with every platform at once.
  5. Note the alpha order reminder: web HEX is #RRGGBBAA while Android, Compose, and Flutter use 0xAARRGGBB. The tool already orders each row correctly.
  6. Use a sample button to see how an opaque or translucent color looks across every platform, or Reset to start over.

About this tool

HEX to Mobile Color Converter takes one color you paste, a HEX value (3, 4, 6, or 8 digits) or an rgb()/rgba() value, and emits ready-to-paste code for the platforms native and cross-platform developers actually ship to: SwiftUI Color, UIKit UIColor, AppKit NSColor, Jetpack Compose Color, Android colors.xml, Android Color.parseColor, Flutter Color from a hex literal, Flutter Color.fromARGB, plus CSS HEX and rgb()/rgba() for reference. It exists because the general CSS color converter on this site stops at web formats, and porting a brand color into mobile code trips developers on two specific things that this tool handles for you. First, channel scale: SwiftUI, UIColor, NSColor, and Flutter floats expect 0.0 to 1.0 values, not 0 to 255, so the tool divides each channel and rounds to three decimals, writing 0.0 and 1.0 with a decimal point so the literal reads as a Double or double. The Channels panel shows both the 0 to 255 byte and the 0.0 to 1.0 float side by side so you can see exactly what each API receives. Second, alpha order: CSS writes the alpha component last as #RRGGBBAA, but Android, Jetpack Compose, and Flutter's hex constructor write it first as 0xAARRGGBB, and mixing the two is the most common color-porting bug. The converter places alpha correctly for each target automatically, so the Compose, Android, and Flutter rows use AARRGGBB while the CSS rows use RRGGBBAA, and you never have to reorder bytes by hand. Input parsing is forgiving: an 8-digit HEX carries transparency, an rgba() fourth value is read whether you give it as 0 to 1, a percent, or 0 to 255, and a bare triple like 59, 130, 246 is treated as RGB. A live swatch sits on a checkerboard so any transparency is obvious at a glance, every row has its own copy button, and Copy all grabs a single commented block with every platform for a constants file or a design hand-off. Everything runs locally in your browser; the colors you paste are never uploaded or logged.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsConverter Tools