Notification
Go to Home All Tools Compare Glossary Blog Contact

HEX to RGBA Converter

Paste a HEX colour and get the RGBA value. Example: gold is #ffd700 = rgba(255, 215, 0, 1). Rounding is stated, and everything runs in your browser.

Client-Side (Private)
Example colour Gold
HEX #ffd700
RGBA rgba(255, 215, 0, 1)
Rounding Channels round half up
Live Preview
e.g. #ffd700
Quick try:
Converted Result (RGBA)

How to convert HEX to RGBA by hand

Step-by-step mathematical method you can verify by hand

  1. Remove the # and split the six digits into three pairs: red, green and blue.
  2. Read each pair as a base-16 number: the first digit counts sixteens and the second counts ones (A to F are 10 to 15).
  3. Write the three values and add the alpha: 1 means fully opaque. For an 8-digit hex colour the last pair is the alpha, divided by 255.

Worked example: gold (#ffd700)

Worked Hand Example
ChannelHex pairCalculationValue
RedFF15 × 16 + 15255
GreenD713 × 16 + 7215
Blue000 × 16 + 00
#ffd700 = rgba(255, 215, 0, 1) (gold).

Common colours: HEX to RGBA

CSS named colours converted both ways.

ColourHEXRGBA
Red #ff0000 rgba(255, 0, 0, 1)
Orange #ffa500 rgba(255, 165, 0, 1)
Gold #ffd700 rgba(255, 215, 0, 1)
Green #008000 rgba(0, 128, 0, 1)
Teal #008080 rgba(0, 128, 128, 1)
Blue #0000ff rgba(0, 0, 255, 1)
Indigo #4b0082 rgba(75, 0, 130, 1)
Purple #800080 rgba(128, 0, 128, 1)
Pink #ffc0cb rgba(255, 192, 203, 1)
Brown #a52a2a rgba(165, 42, 42, 1)
Gray #808080 rgba(128, 128, 128, 1)
Black #000000 rgba(0, 0, 0, 1)
White #ffffff rgba(255, 255, 255, 1)

Alpha (opacity) as an 8-bit hex pair

An 8-digit hex colour ends with the alpha: percentage × 255, written in hex.

OpacityAlpha (0-255)Hex pairExample colour
0% 0 00 #ffd70000
10% 26 1A #ffd7001a
25% 64 40 #ffd70040
50% 128 80 #ffd70080
75% 191 BF #ffd700bf
90% 230 E6 #ffd700e6
100% 255 FF #ffd700ff

Is this colour readable?

Contrast of gold (rgba(255, 215, 0, 1)) against white and black (WCAG 2.x).

Text colourContrast ratioNormal text AA (4.5)Large text AA (3)
White 1.4:1 Fail Fail
Black 14.97:1 Pass Pass

Related converters

Quickly jump to other conversions and color systems

Education

About this converter

01

Exact and Explained

Paste a HEX colour and get the RGBA value. Example: gold is #ffd700 = rgba(255, 215, 0, 1). Rounding is stated, and everything runs in your browser. The worked example and tables on this page are calculated from the numbers themselves, so you can check the result by hand.

02

Privacy

The conversion runs in your browser. Nothing you type is sent to a server.

Good to know

Questions, answered

Quick answers about how this tool works.

gold is rgba(255, 215, 0, 1) (in HEX: #ffd700). These are CSS named colour values.

1. Remove the # and split the six digits into three pairs: red, green and blue. 2. Read each pair as a base-16 number: the first digit counts sixteens and the second counts ones (A to F are 10 to 15). 3. Write the three values and add the alpha: 1 means fully opaque. For an 8-digit hex colour the last pair is the alpha, divided by 255.

Yes. HEX and RGB hold the same 24 bits, so the conversion is lossless in both directions.

All of hex, rgb(), hsl(), and the newer oklch() work in current browsers. Hex is the shortest, hsl() is the easiest to adjust by hand (change only the lightness to make a shade), and oklch() gives the most even lightness steps.

Was this tool helpful?

★ 5.0 • 2 user ratings

Tap a star to rate instantly

What do you need to work out next?

Search 278+ free tools by name, or pick a category below. Every one runs instantly in your browser — no signup, nothing to install.

More Developer Tools
AI ADVISOR & COACH

Ask AI Advisor

Ask AI