Color Converter: HEX, RGB, HSV, Swift & Kotlin

Enter a HEX code or pick a color. Get values and ready-to-paste code for web, iOS and Android.

Aa sample text

Popular colors

Codes Click a line to copy it

Color harmony

Contrast checker (WCAG 2.x) — background is the color above

Aa sample textsample text 14px

Colors from an image

Runs entirely in your browser. Nothing you enter is sent or stored.

How to use

  1. Type a HEX code (#RGB, #RRGGBB or 8 digits) or use the picker.
  2. Choose how 8-digit codes are read: ARGB (iOS/Android) or RGBA (CSS).
  3. Copy the format you need.

Designers hand over colors as HEX codes, but iOS, Android and CSS each want them written differently. This color converter takes a HEX value — #RGB, #RRGGBB or 8 digits — or a pick from the color picker, and outputs HEX, rgb(), rgba(), HSV, a CSS #RRGGBBAA code, a Swift UIColor, a SwiftUI Color, a Kotlin Color(0xAARRGGBB) and an Android <color> resource, all ready to copy.

Three-digit codes are expanded by repeating each digit, so #ABC becomes #AABBCC. For 8-digit codes you choose the alpha position: ARGB, used by Android and many iOS helpers, or RGBA, used by CSS. Swift values are channel ÷ 255 rounded to three decimals. The brightness shown uses the YIQ weights (R×299 + G×587 + B×114) ÷ 1000 on a 0–1 scale; above 0.5 the color counts as light and dark text is suggested, otherwise white text.

Limits: the 4-digit #RGBA shorthand is not read, so use 8 digits instead. The color picker sets only RGB, so choosing a color resets alpha to opaque. HSV values are rounded to whole numbers, and the tool does not convert between color spaces such as Display P3 and sRGB. Characters that are not hex digits, including #, are ignored. The conversion runs entirely in your browser and nothing is sent anywhere.

Use cases & tips

From design file to code

A designer sends you the brand orange as #FF8800. Paste it and the Swift line reads UIColor(red: 1.000, green: 0.533, blue: 0.000, alpha: 1.000), while Kotlin gets Color(0xFFFF8800) and Android gets the same value in a color resource. The 0.533 is 136 ÷ 255, the middle byte. Copy only the line your platform needs, and keep the HEX in your design notes so a later change can be traced back.

The eight-digit trap

Eight digits are ambiguous because platforms disagree on where alpha goes. The orange at 50% opacity is #80FF8800 in ARGB (Android style) and #FF880080 in RGBA (CSS style). Paste the second one while the order is set to ARGB and you do not get a faded orange: alpha becomes FF and the color turns into a dark purple. When a result looks wrong, check the order selector before suspecting the code.

Is the text readable on it?

The swatch suggests dark or white text from a brightness estimate, which is a quick rule of thumb. For a real check use the contrast section, which reports a WCAG ratio. White on #FFD700 gold comes out near 1.4 : 1 and fails, while black on the same gold is roughly 15 : 1. The badges show pass or fail for normal text, large text and interface components at AA and AAA.

Picking colors from a picture, and limits

Drop a screenshot or logo and the tool lists up to six clearly different colors; click any pixel in the preview for its exact value, since the list is grouped and can be slightly off. The image stays in your browser. Keep in mind that four-digit #RGBA is not read, the color picker resets alpha, and anything you paste should be the code alone, because stray letters from a to f are read as digits.

Frequently asked questions

What is the difference between #AARRGGBB and #RRGGBBAA?

Android and many iOS helpers put alpha first (AARRGGBB). CSS puts alpha last (RRGGBBAA). Pick the order that matches where your code came from.

How is the text color chosen?

Brightness uses the YIQ formula (R×299 + G×587 + B×114) ÷ 1000. Above 0.5 the color is light, so dark text is suggested; otherwise white text.

Does 3-digit HEX work?

Yes. #ABC expands to #AABBCC.