HEX to RGB

Convert between color formats.

dodgerblue

#1E90FF

How the hex turns into RGB

Each pair of hex digits is one channel, written in base 16.

  • Red1E1×16 + 1430
  • Green909×16 + 0144
  • BlueFF15×16 + 15255

Code for your project

Ready to paste into web, iOS, Android and Flutter.

HEX to RGB converter

Turn a hex color code into RGB, HSL, CMYK and more, or go the other way from RGB values to hex. Paste a single color, or a whole list, and copy the result in the format you need. It runs in your browser and works well on a phone.

  • Convert in either direction. Type a hex code and read the RGB values, or change the R, G and B boxes and watch the hex code rewrite itself. Both stay in sync.
  • Accepts almost any input. Paste 3, 4, 6 or 8 digit hex with or without the #, rgb() and rgba(), hsl(), hsv(), cmyk(), oklch(), CSS color names or a plain triple like 30 144 255.
  • Alpha channel support. 8 digit hex such as #1E90FF80 is read as 50% opacity and converted to rgba(30, 144, 255, 0.5). The A box edits opacity directly.
  • Ten outputs at once. HEX, RGB, RGB percent, HSL, HSV, CMYK, OKLCH, the nearest CSS name and the integer value, each with its own copy button.
  • Convert a whole list. Switch to Many colors, paste one color per line and convert them all to a single format, then copy the results in one go. Lines that are not colors are flagged, not skipped silently.
  • Code snippets. Get the color as CSS, a CSS variable, a Tailwind class, SwiftUI, UIKit, Android XML, Jetpack Compose and Flutter, with the right alpha-first order for the mobile platforms.

How a hex code becomes RGB

There is no magic in it. A hex code is three numbers written in base 16.

  • Read the hex in pairs. #1E90FF is 1E, 90 and FF. These are red, green and blue, each written in base 16.
  • Convert each pair. The first digit counts sixteens and the second counts ones. So 1E is 1 × 16 + 14 = 30, 90 is 9 × 16 + 0 = 144 and FF is 15 × 16 + 15 = 255.
  • Letters stand for 10 to 15. A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15. That is why a single pair never goes above 255.
  • Short hex doubles each digit. #F80 is shorthand for #FF8800. Every digit is repeated, so only colors whose pairs match can be written in three digits.
  • Where the alpha goes. On the web the two alpha digits come last, as in #RRGGBBAA. Android and Flutter put them first, as AARRGGBB, so the snippets reorder them for you.

Where you will convert colors

  • Moving a design into code. Figma and brand guides hand you hex codes, while canvas, charts and game engines often want separate 0 to 255 channels.
  • Writing translucent CSS. Turn a brand hex into rgba() so you can reuse it for overlays, borders and shadows at any opacity.
  • Porting to mobile. Copy the SwiftUI, UIKit, Compose or Flutter line instead of working out the 0 to 1 fractions and byte order by hand.
  • Cleaning up a stylesheet. Paste every color from a file in Many colors mode and convert them all to one format so the whole sheet is consistent.
  • Learning how color codes work. The breakdown card shows the arithmetic behind each channel, which makes hex much less of a mystery.

HEX and RGB questions

How do I convert HEX to RGB by hand?

Split the code into three pairs, then turn each pair into a number from 0 to 255 by multiplying the first digit by 16 and adding the second. #FF8800 becomes rgb(255, 136, 0).

How do I convert RGB to HEX?

Type the three numbers into the R, G and B boxes. Each one is written as two hex digits and joined, so rgb(255, 136, 0) becomes #FF8800.

What is the difference between RGB and RGBA?

RGBA adds a fourth value from 0 to 1 for opacity. rgba(30, 144, 255, 0.5) is the same blue at half transparency.

Does the # matter?

Not here. 1E90FF and #1E90FF are both read as the same color. In CSS and most design tools you do need the #.

Why does hex use letters?

Base 16 needs sixteen symbols, and 0 to 9 only gives ten. The letters A to F cover 10 to 15.

Can I convert many colors at once?

Yes. Open Many colors, paste one color per line, choose the output format and copy all results. Colors can be in mixed formats.

Is my data sent anywhere?

No. Every conversion runs in your browser.