Skip to main content

RGB to Hex

Convert RGB or RGBA values to a hex colour. Accepts three numbers, rgb() with commas or spaces, percentages and alpha. Free and private.

Need other colour formats? Use the Colour Converter.

64 common colours

NameHexRGB
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)
Brown#a52a2argb(165, 42, 42)
Gold#ffd700rgb(255, 215, 0)
Coral#ff7f50rgb(255, 127, 80)
Salmon#fa8072rgb(250, 128, 114)
Tomato#ff6347rgb(255, 99, 71)
Crimson#dc143crgb(220, 20, 60)
Indigo#4b0082rgb(75, 0, 130)
Violet#ee82eergb(238, 130, 238)
Orchid#da70d6rgb(218, 112, 214)
Plum#dda0ddrgb(221, 160, 221)
Turquoise#40e0d0rgb(64, 224, 208)
Aquamarine#7fffd4rgb(127, 255, 212)
Sky blue#87ceebrgb(135, 206, 235)
Steel blue#4682b4rgb(70, 130, 180)
Royal blue#4169e1rgb(65, 105, 225)
Dodger blue#1e90ffrgb(30, 144, 255)
Forest green#228b22rgb(34, 139, 34)
Sea green#2e8b57rgb(46, 139, 87)
Spring green#00ff7frgb(0, 255, 127)
Chartreuse#7fff00rgb(127, 255, 0)
Khaki#f0e68crgb(240, 230, 140)
Beige#f5f5dcrgb(245, 245, 220)
Ivory#fffff0rgb(255, 255, 240)
Lavender#e6e6fargb(230, 230, 250)
Chocolate#d2691ergb(210, 105, 30)
Sienna#a0522drgb(160, 82, 45)
Tan#d2b48crgb(210, 180, 140)
Slate gray#708090rgb(112, 128, 144)
Dark gray#a9a9a9rgb(169, 169, 169)
Light gray#d3d3d3rgb(211, 211, 211)
Indigo (brand)#6366f1rgb(99, 102, 241)
Sky (brand)#38bdf8rgb(56, 189, 248)
Emerald#10b981rgb(16, 185, 129)
Amber#f59e0brgb(245, 158, 11)
Rose#f43f5ergb(244, 63, 94)
Slate 900#0f172argb(15, 23, 42)
Slate 500#64748brgb(100, 116, 139)
Slate 100#f1f5f9rgb(241, 245, 249)
Teal 500#14b8a6rgb(20, 184, 166)
Violet 500#8b5cf6rgb(139, 92, 246)
Pink 500#ec4899rgb(236, 72, 153)
Red 500#ef4444rgb(239, 68, 68)
Orange 500#f97316rgb(249, 115, 22)
Lime 500#84cc16rgb(132, 204, 22)
Cyan 500#06b6d4rgb(6, 182, 212)
Blue 500#3b82f6rgb(59, 130, 246)

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to Hex to RGB.

Free RGB to Hex

Enter red, green and blue as three numbers, or paste an rgb() value from CSS, and get the hex code. It gives developers a quick browser-based way to solve a focused rgb to hex task before moving the result into a project.

How to use RGB to Hex

Write numbers from 0 to 255, or percentages. Add an alpha with a fourth number or after a slash.

Common mistakes

  • Using a value above 255 or a negative value.
  • Mixing percentages and plain numbers: the same rule is applied to each channel on its own.

Frequently asked questions

How is RGB turned into hex?
Each channel (0 to 255) is written as a two-digit hex number and the three are joined: 99, 102, 241 becomes 63 66 f1, so #6366f1.
Which input forms work?
99, 102, 241 — rgb(99, 102, 241) — rgb(99 102 241) — rgb(40% 50% 60%) — rgba(99, 102, 241, 0.5) — rgb(99 102 241 / 50%).
What if a number is above 255?
The page tells you which channel is out of range.
Is anything uploaded?
No. The conversion runs in your browser.
How do I use this rgb to hex tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Code & Conversion

View all Code & Conversion tools →