Hex to RGB Converter

Turn any hex colour code into an RGB value instantly.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

Hex to RGB converter

This tool converts any hex colour code into its RGB equivalent and shows a live swatch. It is for developers and designers moving colours between CSS, design tools and code where one format is required and another is on hand. Paste a hex value or use the picker, and read the rgb() string plus each channel.

How it works

A hex colour encodes three 8-bit channels in base 16. The converter strips an optional leading #, and if you pass 3-digit shorthand it doubles each digit (#abc#aabbcc). It then splits the 6 digits into three pairs and converts each pair from base 16 to a 0–255 decimal value for red, green and blue. Those become the rgb(r, g, b) string and the individual channel readouts. Anything that is not a valid 3- or 6-digit hex code is rejected with an inline message rather than a guessed colour.

Example

For #3b82f6, the three pairs convert as:

  • 3b (hex) = 3×16 + 11 = 59
  • 82 (hex) = 8×16 + 2 = 130
  • f6 (hex) = 15×16 + 6 = 246

So #3b82f6 becomes rgb(59, 130, 246).

HexRGB
#000000rgb(0, 0, 0)
#ffffffrgb(255, 255, 255)
#fffrgb(255, 255, 255)
#ff0000rgb(255, 0, 0)
#3b82f6rgb(59, 130, 246)

Everything happens in your browser — nothing is uploaded.

Ad placeholder (rectangle)