Blog
Unit converters

HEX to RGB converter

Enter a HEX color code (for example #3B82F6 or the short form #3af) and the converter shows the color as RGB: separate red, green and blue channel values, a ready-made CSS string, and a live color swatch.

Your data never leaves this device

Result

rgb() string
Red (R)
Green (G)
Blue (B)

This page has no server side at all. The table you paste is parsed by JavaScript inside your own browser, the chart is drawn on a canvas element on your machine, and the export file is assembled locally. Nothing is uploaded, stored or written to any log. You can disconnect from the network after the page has loaded and everything will still work — which is the simplest way to verify the claim yourself.

Facts and limits of this method

Short form #RGB — each digit is duplicated (#3af → #33aaff)
Full form #RRGGBB — six hexadecimal digits
R/G/B range 0 to 255 for each channel
Leading hash Optional — "3B82F6" is recognized the same as "#3B82F6"

When it misleads you

How it is calculated

The HEX code is checked against the short (3-digit) or full (6-digit) format, with an optional leading hash stripped.

The short form is expanded to the full form by duplicating each digit: "3af" becomes "33aaff".

Each pair of hex digits is converted to a decimal number from 0 to 255 — these are the red, green and blue values respectively.

The color swatch is filled directly with the same HEX code via CSS, so it visually matches what you'd get using that color in a real layout.

Questions and answers

Do I need a leading hash before the HEX code?

No, the converter recognizes the code with or without one — "3B82F6" and "#3B82F6" give the same result.

Does the 3-character short form work?

Yes, "#3af" is automatically expanded to the full "#33aaff" before the calculation.

What about transparency (the alpha channel)?

This converter only handles opaque colors. For a HEX code with an alpha channel, use the separate HEX to RGBA converter.

Is my data sent anywhere?

No, the whole calculation runs in your browser.

Related tools

All tools