HEX to RGB

Convert HEX color codes to RGB and RGBA values.

  • Runs in your browser
  • Free, no sign-up

Quick colors

  • RGB-
  • RGBA-
  • R, G, B-
  • Percent-
  • 0 to 1-
  • HSL-

Convert a list

About the HEX to RGB

The HEX to RGB Converter turns a color code like #FF5733 into its red, green and blue values. You get the CSS rgb() and rgba() forms, the bare numbers, percentages, values from 0 to 1 and the matching HSL, each with its own Copy button.

HEX is how colors are usually shared in design files and brand guides, but many places want RGB instead: CSS with transparency, Android and iOS code, game engines, charting libraries, email builders and spreadsheet formatting. This tool saves you from working out the base-16 math by hand.

It reads short codes (#F53), full codes (#FF5733) and codes with transparency (#FF573380), with or without the #. A list mode converts many colors at once. Everything runs in your browser.

How to use it

  1. Enter a HEX codeType or paste a code with 3, 4, 6 or 8 hex digits. The # is optional and upper or lower case both work.
  2. Or pick a colorUse the color box next to the field, or click one of the quick colors below it.
  3. Read the resultsThe preview shows the color, and the list shows RGB, RGBA, the bare values, percentages, 0 to 1 values and HSL.
  4. Copy the format you needEach row has a Copy button, so you can paste straight into CSS, code or a design app.
  5. Convert a listPaste one HEX code per line under "Convert a list" to get one rgb() or rgba() value per line.

Key features

All HEX lengths

3-digit shorthand, 4-digit shorthand with alpha, 6-digit and 8-digit with alpha, with or without #.

Six output formats

rgb(), rgba(), plain "R, G, B" numbers, percentages, values from 0 to 1, and HSL.

Transparency included

With 4 or 8 digits, the last part becomes the alpha value, shown in RGBA and in the 0 to 1 list.

List conversion

Converts many codes at once. Empty lines are skipped, and lines that are not valid HEX are marked "invalid:" instead of disappearing.

Clear error message

If the code has the wrong number of digits or a letter beyond F, the tool says so and clears the results, so you never copy a stale value.

Private by design

Nothing is sent anywhere. The conversion is simple math in your browser.

Examples

A full HEX code

The tool starts with #FF5733, a warm orange-red:

FormatResult
RGBrgb(255, 87, 51)
RGBArgba(255, 87, 51, 1)
R, G, B255, 87, 51
Percentrgb(100%, 34.1%, 20%)
0 to 11.000, 0.341, 0.200
HSLhsl(11, 100%, 60%)

How the math works

A HEX code is three pairs of base-16 digits: red, green and blue. Each pair is a number from 00 to FF, or 0 to 255. The digits A to F stand for 10 to 15, and the first digit of a pair counts sixteen times:

PairCalculationValue
FF (red)15 × 16 + 15255
57 (green)5 × 16 + 787
33 (blue)3 × 16 + 351

The 0 to 1 values divide each number by 255, so 87 becomes 0.341. That is the form Swift, Unity, OpenGL and many other graphics tools use.

Shorthand and transparency

HEXRGBA
#F53rgba(255, 85, 51, 1)
#FF573380rgba(255, 87, 51, 0.502)
#F538rgba(255, 85, 51, 0.533)

In shorthand, every digit is doubled, so #F53 means #FF5533, which is close to but not the same as #FF5733. In 8-digit codes, the last pair is the opacity: 80 is 128 out of 255, or 0.502. A 4-digit code works the same way, with 8 standing for 88 (136 out of 255, or 0.533).

Converting a list

Paste these lines under "Convert a list":

#FF5733
2b59ff
#C6F24E80
#fff
blue

The result is rgb(255, 87, 51), rgb(43, 89, 255), rgba(198, 242, 78, 0.502), rgb(255, 255, 255) and invalid: blue. Color names are not HEX codes; the Color Picker reads those.

Tips

  • Use rgba() when you need transparency in CSS that older tools must read. Modern CSS also accepts 8-digit HEX directly, such as #FF573380.
  • When a mobile or game developer asks for "float" values, copy the 0 to 1 row. Each number is the RGB value divided by 255.
  • Keep brand colors as 6-digit HEX in your style guide and convert when needed. Shorthand codes only exist for colors whose pairs repeat, like #FF5533.
  • Convert a whole brand palette at once with the list mode, then paste the results into your stylesheet or design tokens.
  • If you need to go the other way, the RGB to HEX converter turns rgb() values and sliders back into a HEX code.

Common mistakes and limits

  • Expanding shorthand the wrong way#F53 is #FF5533, not #F50033 or #F05030. Each single digit is repeated, never padded with a zero.
  • Reading the alpha pair as a percentageIn #FF573380, 80 is hexadecimal for 128, which is about 50% opacity, not 80%.
  • Mixing up ARGB and RGBA orderCSS puts the alpha last (#RRGGBBAA). Android and some other platforms put it first (#AARRGGBB). Move the pair before pasting into those.
  • Typing the letter O instead of zeroHEX only uses 0 to 9 and A to F. An O, G or a space makes the code invalid, and the tool shows an error.
  • Expecting HSL to convert back exactlyHSL is rounded to whole numbers here, so converting it back can be off by one or two in each RGB value.

Frequently asked questions

How do I convert HEX to RGB by hand?
Split the code into three pairs. For each pair, multiply the first digit by 16 and add the second, counting A to F as 10 to 15. FF is 255, 57 is 87 and 33 is 51.
What does an 8-digit HEX code mean?
The first six digits are red, green and blue. The last two are the alpha (opacity), from 00 (fully transparent) to FF (fully opaque).
What is the difference between rgb() and rgba()?
rgba() adds a fourth value for opacity between 0 and 1. In modern CSS, rgb() accepts an alpha too, but rgba() is still the most widely supported way to write it.
Do I need the # sign?
No. FF5733 and #FF5733 give the same result. CSS needs the # in your stylesheet, though.
Are HEX codes case sensitive?
No. #ff5733 and #FF5733 are the same color.
What are the percentage and 0 to 1 values for?
Some tools describe colors as a share of the maximum instead of 0 to 255. Percentages appear in CSS and design apps, 0 to 1 values in Swift, Unity, OpenGL and shaders.
Can I convert color names like "blue"?
Not here; this converter only reads HEX. The Color Picker accepts names and every other CSS color format.
Is anything I enter stored?
No. Everything is converted in your browser and nothing is saved or sent.