🔢 HEX to RGB Converter

Convert HEX to RGB and RGB to HEX instantly. Paste a hex code or enter RGB values to get every format — RGBA, HSL, CMYK — plus a per-channel decimal/hex/binary breakdown and contrast. Free, instant & 100% private.

Aa
≈ Royal BlueDarkCopied!
#

Accepts 3, 6 or 8 digits — with or without #.

RGB values
Opacity100%

🔬 Channel Breakdown

Every RGB channel shown four ways — the same number in decimal, hexadecimal, percentage, and 8-bit binary.

Red
Decimal
37
Hex
25
Percent
15%
Binary
00100101
Green
Decimal
99
Hex
63
Percent
39%
Binary
01100011
Blue
Decimal
235
Hex
EB
Percent
92%
Binary
11101011

📊 Color Properties

Hue221°
Saturation83%
Lightness53%
Brightness96/255
Luminance0.153
Closest nameRoyal Blue

♿ Readability (WCAG Contrast)

On white5.17:1
Passes AA ✓
On black4.06:1
Fails AA ✗

Everything This Converter Gives You

More than a simple HEX ↔ RGB swap — a complete color-code workbench for developers and designers.

🔄

Two-Way Conversion

Edit the HEX field or the RGB values — both stay in sync instantly. Convert in whichever direction you need.

🎚️

Sliders + Inputs

Type exact channel values or drag R, G, B sliders to fine-tune. A native color picker is built in too.

🧮

Channel Breakdown

See each channel as decimal, hexadecimal, percentage and 8-bit binary — great for learning how colors are encoded.

🌈

More Formats

Beyond HEX and RGB, get RGBA, 8-digit HEX, HSL and CMYK — all one-click copyable.

Contrast Check

Instantly see WCAG contrast against white and black so you know if text will be readable.

🔒

Free & Private

No login, no limits, and all processing happens in your browser. Works great on mobile and in dark mode.

How to Convert HEX and RGB

It works both ways — edit either side and the other updates live.

1

Paste a HEX code

Drop your hex (3, 6 or 8 digits, # optional) into the HEX field to get RGB instantly.

2

…or enter RGB values

Type R, G, B (0–255) or drag the sliders to convert the other way to a hex code.

3

Adjust opacity (optional)

Use the opacity slider to get RGBA and 8-digit HEX with an alpha channel.

4

Copy any format

Tap HEX, RGB, RGBA, HSL or CMYK to copy it straight to your clipboard.

Frequently Asked Questions

HEX to RGB, RGB to HEX, the conversion formula, 8-digit hex, and why values run 0–255.

How do I convert a HEX code to RGB?

Type or paste your hex code into the HEX field — for example 2563EB. The RGB values update instantly (here, rgb(37, 99, 235)). Each pair of hex digits is one channel: the first two are red, the middle two are green, the last two are blue. Click any output to copy it.

How do I convert RGB to HEX?

Enter your red, green and blue values (0–255) in the RGB fields, or drag the sliders. The HEX code updates live above. Each channel is converted to a two-digit hexadecimal number and joined together as #RRGGBB.

What is the formula to convert HEX to RGB?

Split the six-digit hex into three pairs and convert each pair from base-16 to base-10. For #2563EB: 25 → 37, 63 → 99, EB → 235, giving rgb(37, 99, 235). To go the other way, convert each 0–255 value back to a two-digit hex number.

What does an 8-digit hex code (HEX8) mean?

An 8-digit hex is #RRGGBBAA, where the last two digits are the alpha (opacity) channel from 00 (transparent) to FF (opaque). Use the opacity slider to set it — the tool shows both the HEX8 and the matching rgba() value.

Can I use a 3-digit shorthand hex?

Yes. A 3-digit hex like #2BE is shorthand where each digit is doubled, so #2BE expands to #22BBEE. Paste either form and the converter handles it.

Why are RGB values between 0 and 255?

Each channel is stored in 8 bits (one byte), and 8 bits can represent 256 distinct values — 0 through 255. That's why every red, green or blue level tops out at 255, and why two hex digits (00–FF) map perfectly onto one channel.

Is HEX the same color as RGB?

Yes — HEX and RGB are just two ways of writing the same on-screen color. HEX is a compact hexadecimal notation; RGB lists the same three channel values in decimal. Converting between them never changes the actual color.

Is this converter free and private?

Completely free with no sign-up, and everything runs in your browser — no color data is sent to any server. It works on Chrome, Firefox, Safari, Edge and mobile browsers.