Skip to content

Flagship color workspace

RGB to Hex Converter

Parse integer or percentage RGB, modern CSS, legacy commas, and alpha. Then copy normalized Hex, LAB/LCH, OKLCH, snippets, perceptual states, and measured contrast without re-entering the color.

Synchronized color

#FF5733

Parsed as RGB; malformed or out-of-range channels are rejected, never silently clamped.

Integer or percentage RGB, modern or legacy CSS, Hex with optional alpha, HSL, HSV, OKLCH, LAB, LCH, CMYK, or a CSS name.

100%

Adjust channels

255
87
51

Share this exact input

?color=FF5733

One input, implementation-ready output

Color workspace

Hex

#RRGGBB

#FF5733

CSS RGB

Modern space syntax

rgb(255 87 51)

Legacy RGB

Comma syntax

rgb(255, 87, 51)

RGB %

Percentage channels

rgb(100% 34.1% 20%)

HSL

CSS hue, saturation, lightness

hsl(11 100% 60%)

HSV / HSB

Design-tool model

hsv(11, 80%, 100%)

OKLCH

Perceptual CSS color

oklch(68% 0.21 33.7)

LAB

CSS Lab, D50

lab(61.03% 63.55 55.96)

LCH

CSS LCH, D50

lch(61.03% 84.67 41.37)

CMYK

Unprofiled approximation

cmyk(0%, 66%, 80%, 0%)

How to Convert RGB to Hex

Each RGB channel (0-255) becomes a two-digit hexadecimal pair. The three pairs concatenated with a leading # form the hex code:

  1. Divide the channel value by 16. The whole-number quotient is the first hex digit.
  2. The remainder is the second hex digit (10=A, 11=B, 12=C, 13=D, 14=E, 15=F).
  3. Repeat for red, green, and blue.
  4. Concatenate the pairs as #RRGGBB.

Example: convert rgb(255, 87, 51) to hex

255 ÷ 16 = 15 remainder 15 → FF

87 ÷ 16 = 5 remainder 7 → 57

51 ÷ 16 = 3 remainder 3 → 33

Result: #FF5733

How to Use the RGB to Hex Converter

Enter integer or percentage channels using modern CSS, legacy commas, a bare RGB triplet, or an alpha-aware format. The synchronized workspace preserves transparency, rejects malformed input, and shows normalized Hex, RGB, HSL, HSV, LAB/LCH, OKLCH, and an unprofiled CMYK approximation.

Understanding RGB Color Model

RGB stands for Red, Green, Blue - the three primary colors of light. Computer displays create colors by mixing these three light sources at different intensities. Each channel has 256 levels (0-255), allowing for 16,777,216 unique colors. When all channels are at 0, you get black; when all are at 255, you get white.

Common Use Cases

Converting RGB to hex is essential when copying colors from JavaScript color pickers to CSS stylesheets, when working with design specifications that provide RGB values, or when you need a more compact color representation. Many brand guidelines specify colors in RGB, but web implementations require hex codes.

RGB to Hex Conversion Table

RGB and hex values for the most commonly used colors. Click any hex code to load it into the converter above.

ColorNameHexRGB
Black#000000rgb(0, 0, 0)
White#FFFFFFrgb(255, 255, 255)
Red#FF0000rgb(255, 0, 0)
Lime#00FF00rgb(0, 255, 0)
Blue#0000FFrgb(0, 0, 255)
Yellow#FFFF00rgb(255, 255, 0)
Cyan#00FFFFrgb(0, 255, 255)
Magenta#FF00FFrgb(255, 0, 255)
Silver#C0C0C0rgb(192, 192, 192)
Gray#808080rgb(128, 128, 128)
Maroon#800000rgb(128, 0, 0)
Olive#808000rgb(128, 128, 0)
Green#008000rgb(0, 128, 0)
Purple#800080rgb(128, 0, 128)
Teal#008080rgb(0, 128, 128)
Navy#000080rgb(0, 0, 128)
Orange#FFA500rgb(255, 165, 0)
Pink#FFC0CBrgb(255, 192, 203)
Gold#FFD700rgb(255, 215, 0)
Brown#A52A2Argb(165, 42, 42)
Coral#FF7F50rgb(255, 127, 80)
Indigo#4B0082rgb(75, 0, 130)
Violet#EE82EErgb(238, 130, 238)
Salmon#FA8072rgb(250, 128, 114)

Need a value that is not listed? Browse the full color library — every hex code has a page with its RGB, HSL, CMYK and OKLCH values, contrast ratios, tints, shades and matching palette colors.

Frequently Asked Questions about RGB to Hex Converter

Use integers from 0 to 255 or percentages from 0% to 100% for red, green, and blue. Out-of-range or malformed channels are rejected with a clear error rather than silently clamped.