Hex to RGB converter

Paste a hex color code and read off the exact rgb() value in a heartbeat — plus HSL and a live swatch. Flip the arrow to go the other way and turn RGB back into hex.

Both directions 3 & 6 digit hex Instant preview 100% private
Live preview
Hex#f59e0b
RGBrgb(245, 158, 11)
HSLhsl(38, 92%, 50%)

How to convert hex to RGB

1

Drop in a hex code

Type or paste a value like #1e90ff into the hex field. The leading hash is optional, and shorthand codes such as #0af are expanded automatically.

2

Read the RGB result

The matching rgb() triplet appears at once, along with the HSL version and a full-width swatch so you can confirm the color looks right.

3

Copy or reverse it

Copy whichever code you need, or press the swap arrow to type an RGB value and get the hex back. No button-mashing, no page reloads.

How the conversion actually works

A hex color code packs three numbers into six characters. Read left to right, the pairs are red, green and blue, each written in hexadecimal — base 16 — so they run from 00 up to ff. Converting to RGB just means translating each pair back into an ordinary decimal number between 0 and 255.

A worked example

Take #f59e0b. The red pair f5 is (15×16) + 5 = 245. The green pair 9e is (9×16) + 14 = 158. The blue pair 0b is (0×16) + 11 = 11. So #f59e0b equals rgb(245, 158, 11) — the exact amber this site is built around.

Shorthand hex

Three-digit codes are a compact form where each character is doubled: #0af means #00aaff. This tool expands them for you before converting, so both forms give the same RGB result.

ColorHexRGB
Black#000000rgb(0, 0, 0)
White#ffffffrgb(255, 255, 255)
Red#ff0000rgb(255, 0, 0)
Green#00ff00rgb(0, 255, 0)
Blue#0000ffrgb(0, 0, 255)
Amber#f59e0brgb(245, 158, 11)

Questions people ask

Do I need to include the # symbol?

No. You can paste the hex with or without the leading hash, in upper or lower case. The converter cleans up the input before reading it.

Does it support 3-digit shorthand hex?

Yes. A three-character code like #e91 is expanded to its six-character form (#ee9911) automatically, so the RGB output is always correct.

Can it convert RGB back to hex?

Yes. Press the swap arrow between the two fields, type an RGB triplet such as 34, 197, 94, and the hex equivalent updates live.

What about alpha or transparency?

This converter focuses on solid colors. For transparent RGBA and eight-digit hex, use the main color picker, which includes an opacity slider.

Is anything sent to a server?

No. The math runs entirely in your browser, so your color values stay on your device and the tool keeps working even offline.

Why do my RGB numbers only go up to 255?

Each channel uses 8 bits, which can represent 256 distinct levels — 0 through 255. That is exactly what two hex characters cover, from 00 to ff.

Copied