LazyTools

🔒 Every tool runs in your browser, the files and values you enter are never uploaded to any server. How it works

#️⃣ HEX to RGB Converter

A HEX code is RGB in base-16: #1d87f1 converts to rgb(29, 135, 241), paste any code and read the channels.

Rate this tool:
Anonymous, no account, no identifier

How the hex to rgb converter works

Each pair of HEX digits is one channel in base-16: the first pair red, the second green, the third blue. To read one pair, multiply its first digit by 16 and add the second, where the letters a, f stand for 10-15: 1d = 1×16 + 13 = 29, 87 = 8×16 + 7 = 135, f1 = 15×16 + 1 = 241, giving rgb(29, 135, 241). Two HEX digits span 00-ff, exactly the 0-255 range of an 8-bit channel, so the mapping is lossless. Three-digit shorthand doubles each digit (#fa0 = #ffaa00).

You need this conversion any time CSS or a design tool wants numeric channels, rgba() with transparency being the everyday case: take the RGB values and add your alpha, e.g. rgba(29, 135, 241, 0.5).

Frequently asked questions

How do I convert HEX to RGB manually?

Split the six digits into three pairs and convert each from base-16: multiply the first digit by 16 and add the second (letters a, f are 10-15). f1 = 15×16 + 1 = 241.

How do I get rgba() transparency from a HEX code?

Convert to RGB here, then add the alpha: #1d87f1 at 50% = rgba(29, 135, 241, 0.5). (Modern CSS also accepts 8-digit HEX, where the last pair is alpha: #1d87f180.)

What if my code has only 3 digits?

It is shorthand, each digit doubles. #09c = #0099cc = rgb(0, 153, 204). The tool handles both.

Are HEX and RGB ever different colors?

Never. They are two notations for identical values. Any difference you see comes from color profiles or display settings, not the notation.

Worked example: what is #00ff80 in RGB?

00 = 0, ff = 255, 80 = 8×16 + 0 = 128, so #00ff80 is rgb(0, 255, 128), a bright spring green. Reading each pair independently is all it takes.

Why does two HEX digits cover exactly 0-255?

Each digit is a base-16 place, so two digits range from 00 to ff, and ff = 15×16 + 15 = 255. That is precisely the span of an 8-bit colour channel, which is why one byte per channel and one HEX pair per channel line up perfectly.

Does the tool upload my values?

No, conversion is local and instant.

Related color tools

From the blog