Colors

HEX to RGB Converter

Paste a HEX code or an rgb() value and read the other format instantly, with copy buttons and full alpha support. No account, no limits, and nothing leaves your browser.

 

Try
#34d399 = rgb(52, 211, 153)

Building a full palette?

The free color picker adds a screen eyedropper, color harmonies, a palette builder, and CSS, JSON, and Tailwind export. One free account, yours for life.

Open the color picker

How it works

HEX to RGB in three steps

  1. 1Type or paste a color in either format, like #34d399 or rgb(52, 211, 153). Shorthand HEX and rgba() work too.
  2. 2Read both outputs instantly: the normalized HEX code and the CSS rgb() value, with alpha carried through when present.
  3. 3Click Copy next to the value you need, or open the full color picker to build a palette around it.

Common colors in HEX and RGB

The standard CSS colors you reach for most, already converted. Click into the converter above to tweak any of them.

ColorHEXRGB
White#FFFFFFrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)
Red#FF0000rgb(255, 0, 0)
Orange#FFA500rgb(255, 165, 0)
Yellow#FFFF00rgb(255, 255, 0)
Lime#00FF00rgb(0, 255, 0)
Green#008000rgb(0, 128, 0)
Cyan#00FFFFrgb(0, 255, 255)
Blue#0000FFrgb(0, 0, 255)
Navy#000080rgb(0, 0, 128)
Magenta#FF00FFrgb(255, 0, 255)
Purple#800080rgb(128, 0, 128)
Silver#C0C0C0rgb(192, 192, 192)
Gray#808080rgb(128, 128, 128)
Maroon#800000rgb(128, 0, 0)
Teal#008080rgb(0, 128, 128)

What you get

Everything included, free

Two-way conversion

One input handles both directions. Paste HEX to get RGB, paste rgb() to get HEX, and the outputs update as you type.

Alpha support

Eight-digit HEX codes convert to rgba() and back, so transparency survives the round trip.

Copy-ready CSS

Outputs are exact CSS syntax, ready to paste into a stylesheet without reformatting.

Shorthand friendly

Three-digit codes like #fa0 expand automatically to their six-digit form before converting.

Live swatch preview

A preview swatch shows the parsed color as you type, so a typo is obvious before you copy anything.

The math behind HEX to RGB

A HEX color is three base-16 numbers wearing a # prefix. Base-16 uses the digits 0-9 plus a-f, and two of those digits cover exactly 0 to 255, the same range as an RGB channel. The first pair is red, the second green, the third blue. To convert a pair by hand, multiply the first digit's value by 16 and add the second: d3 is 13 × 16 + 3 = 211.

Going the other way, divide the channel by 16: the quotient is the first digit and the remainder is the second, so 52 becomes 3 and 4, written 34. Because the two systems map one-to-one, no precision is lost in either direction. That is why this converter is exact rather than approximate, and why you can round-trip a color between formats as many times as you like.

When to use HEX and when to use RGB

HEX is the compact form you will meet in stylesheets, design tools, and brand guidelines; it is short, unambiguous, and easy to paste around. rgb() spells out the channels, which is clearer to read in code review and is the form canvas drawing, image processing, and most graphics APIs actually consume. When you need transparency, rgba() and eight-digit HEX carry the same information, so pick whichever your codebase already uses and stay consistent.

FAQ

Frequently asked questions

How do I convert HEX to RGB?

Split the HEX code into three pairs and read each pair as a base-16 number from 0 to 255. For #34d399: 34 is 52, d3 is 211, and 99 is 153, so the result is rgb(52, 211, 153). This converter does that instantly in both directions.

How do I convert RGB to HEX?

Convert each channel to a two-digit base-16 number and join them: rgb(52, 211, 153) becomes 34, d3, and 99, or #34d399. Values below 16 keep a leading zero, so rgb(0, 128, 0) is #008000.

How does alpha work in HEX?

An eight-digit HEX code appends a fourth pair for opacity, from 00 (fully transparent) to ff (fully opaque). The pair converts to 0-255 and divides by 255: #34d39980 has alpha 80, which is 128, so it converts to rgba(52, 211, 153, 0.5).

Is #fff the same as #ffffff?

Yes. Three-digit HEX is shorthand where each digit doubles, so #fff expands to #ffffff and #fa0 expands to #ffaa00. Four-digit shorthand works the same way with the last digit doubling into an alpha channel.

Do I need an account?

No. This converter is free for everyone with no sign-in. The full color picker it links to uses a free Bravely account for its one-time lifetime claim and palette exports.

Is my color sent anywhere?

No. The conversion runs entirely in your browser, and nothing you type is sent to a server.

More free tools

Keep the streak going

From the same studio

Bravely Studios builds nine cross-platform desktop utilities — screenshots, PDF signing, remote desktop and more — with one plan that unlocks all of them. Free tools are how we say hello.