Skip to content
Live Swatch Hex and RGB Ready for CSS

Hex to RGB Color Converter

Paste any hex color code and get the RGB values instantly, then keep going with worked examples, visual channel diagrams, a reference palette, reverse conversion, and ready-to-copy CSS snippets.

Tool

Hex to RGB converter

#

Supports 3-digit and 6-digit web colors like `#F3A` or `#FF6B35`.

Converter ready. Enter a hex code or RGB values.

RGB Output

rgb(255, 107, 53)

CSS Snippet

color: #FF6B35;
background: rgb(255, 107, 53);
#FF6B35 255 · 107 · 53
Red255
Green107
Blue53

Quick read

The visual swatch updates live so every section on this page stays tied to a real color, not just abstract numbers.

Visual Format

How the #RRGGBB format works

Every hex color is really three tiny numbers packed into one compact code. Read left to right: red pair, green pair, blue pair.

#
RR Red channel
GG Green channel
BB Blue channel

Channel Range

00No intensity
7FMid range
FFFull intensity

Each pair can represent 256 values, from 0 through 255. That is why hex maps perfectly to RGB channel numbers.

Formula

Hex to RGB in three visual steps

The converter is instant, but the logic is simple enough to understand at a glance. Each pair follows the same base-16 rule.

1

Split the color into three pairs

A standard web color uses the #RRGGBB format. That means the first pair is red, the middle pair is green, and the last pair is blue.

2

Convert each pair from base 16

Read each pair as hexadecimal. A through F represent 10 through 15, so FF is 255, 6B is 107, and 35 is 53.

3

Assemble the RGB result

Place the decimal results into rgb(R, G, B). Once each pair is converted, you have the exact browser-ready color value.

Channel Formula

value = (first digit × 16) + second digit

FF (15 × 16) + 15 = 255
6B (6 × 16) + 11 = 107
35 (3 × 16) + 5 = 53

Flow Diagram

Hex Pair
Base-16 Math
Decimal Channel
rgb(R, G, B)
Worked Examples

See each pair become a channel

These examples keep the conversion grounded in real colors you would actually use in interfaces, dashboards, and design systems.

Example

#FF6B35

Red

FF

(15 × 16) + 15

255

Green

6B

(6 × 16) + 11

107

Blue

35

(3 × 16) + 5

53
Result rgb(255, 107, 53)

Example

#1A73E8

Red

1A

(1 × 16) + 10

26

Green

73

(7 × 16) + 3

115

Blue

E8

(14 × 16) + 8

232
Result rgb(26, 115, 232)

Reverse Conversion

RGB to hex uses the same channels in reverse

Start with values between 0 and 255. Convert each one to a two-digit hexadecimal value, then join the red, green, and blue pairs together.

255FF
1076B
5335
rgb(255, 107, 53) → #FF6B35

Developer Snippets

JavaScript

const hex = "#FF6B35".replace("#", "");
const [r, g, b] = [0, 2, 4].map((i) =>
  parseInt(hex.slice(i, i + 2), 16)
);

Python

hex_code = "#FF6B35".lstrip("#")
rgb = tuple(int(hex_code[i:i+2], 16) for i in (0, 2, 4))
Reference Palette

16 common web colors with hex and RGB values

A visual reference table is often faster than mental conversion when you are checking brand colors, utility classes, or basic UI tokens.

Black

#000000

rgb(0, 0, 0)

White

#FFFFFF

rgb(255, 255, 255)

Red

#FF0000

rgb(255, 0, 0)

Lime

#00FF00

rgb(0, 255, 0)

Blue

#0000FF

rgb(0, 0, 255)

Yellow

#FFFF00

rgb(255, 255, 0)

Cyan

#00FFFF

rgb(0, 255, 255)

Magenta

#FF00FF

rgb(255, 0, 255)

Silver

#C0C0C0

rgb(192, 192, 192)

Gray

#808080

rgb(128, 128, 128)

Maroon

#800000

rgb(128, 0, 0)

Olive

#808000

rgb(128, 128, 0)

Green

#008000

rgb(0, 128, 0)

Purple

#800080

rgb(128, 0, 128)

Teal

#008080

rgb(0, 128, 128)

Navy

#000080

rgb(0, 0, 128)

FAQ

Frequently asked questions about hex and RGB

How do I convert hex to RGB? +

Split the hex code into red, green, and blue pairs. Convert each pair from base 16 to decimal, then format the result as rgb(R, G, B). For example, #FF6B35 becomes rgb(255, 107, 53).

Can I use 3-digit hex codes like #F3A? +

Yes. Expand each digit so #F3A becomes #FF33AA before converting. Each doubled pair then maps to one RGB channel.

What does #RRGGBB mean? +

RR is the red channel, GG is the green channel, and BB is the blue channel. Each pair runs from 00 to FF, which maps to 0 through 255 in decimal.

Why do designers use hex while developers often use RGB? +

Hex is compact and easy to copy from design tools. RGB is easier when code or graphics APIs need separate channel values, especially for calculations and opacity.

Can this converter work in reverse from RGB to hex? +

Yes. Enter red, green, and blue values from 0 to 255 and the tool will generate the matching hex code instantly.

How do I add transparency? +

Use rgba() for alpha transparency. Convert the base color to RGB first, then add a fourth value between 0 and 1, such as rgba(255, 107, 53, 0.5).

What is the hex to RGB formula? +

For each 2-character channel pair, convert with channel = firstDigit * 16 + secondDigit. Repeat for red, green, and blue.

Do lowercase and uppercase hex letters matter? +

No. #ff6b35 and #FF6B35 represent the same color. Most tools normalize the final result to uppercase for readability.

Are 8-digit hex codes supported? +

This page focuses on 3-digit and 6-digit web hex colors. 8-digit hex adds an alpha channel at the end, such as #RRGGBBAA.

Where is hex to RGB used most often? +

It is common in CSS, HTML, design systems, component libraries, branding guides, Figma handoff files, and small utility scripts.

Can I copy CSS directly from this tool? +

Yes. The converter generates both the hex value and ready-to-paste CSS lines so you can move straight into styling work.

Is this tool free? +

Yes. It runs in the browser with no signup, no file upload, and no limit on the number of color conversions.