RGB to Hex & Hex to RGB Converter

Make it a gradient →

Want a palette around this color? Use the Color Palette Generator →

Hex
 
RGB
 
HSL
 
OKLCH
 
HSV
 
HTML color name
 

About this tool

RGB and hex are the two most common ways to write a color in CSS — RGB describes a color as three numbers (red, green, blue, each 0-255), while hex packs the same three values into a 6-character code like #FF6347. Type into either side and the other updates: use it when a color picker, design tool, or eyedropper gives you an RGB value and you need the hex code for your CSS, or the other way round, when you have a hex code and need RGB, for example to reuse the color with an opacity value via rgba(), since hex alone doesn't support transparency (outside of the less-common 8-digit hex format).

FAQ

How do I convert an RGB color to hex?

Enter the Red, Green, and Blue values (0-255 each) into the fields above — the hex code, along with the equivalent HSV and HSL values, updates instantly.

How do I convert a hex color to RGB?

Type the hex code (with or without the #, 3 or 6 digits) into the Hex field — the Red, Green, and Blue values, along with the equivalent HSV and HSL values, update instantly.

What's the hex code for a specific color name?

Check the table below for common colors, or browse the full Color Names list.

Can I convert a color with transparency (RGBA) to hex?

Yes, with an 8-digit hex code (#RRGGBBAA) — the last two characters encode the alpha channel. Standard 6-digit hex has no transparency.

Hex & RGB codes for common colors

Color Name Hex Code RGB Code
Black #000000 rgb(0, 0, 0)
White #FFFFFF rgb(255, 255, 255)
Gray #808080 rgb(128, 128, 128)
Silver #C0C0C0 rgb(192, 192, 192)
Red #FF0000 rgb(255, 0, 0)
Crimson #DC143C rgb(220, 20, 60)
Tomato #FF6347 rgb(255, 99, 71)
Orange #FFA500 rgb(255, 165, 0)
Gold #FFD700 rgb(255, 215, 0)
Yellow #FFFF00 rgb(255, 255, 0)
Green #008000 rgb(0, 128, 0)
Lime #00FF00 rgb(0, 255, 0)
Teal #008080 rgb(0, 128, 128)
Cyan #00FFFF rgb(0, 255, 255)
Blue #0000FF rgb(0, 0, 255)
Navy #000080 rgb(0, 0, 128)
Indigo #4B0082 rgb(75, 0, 130)
Purple #800080 rgb(128, 0, 128)
Violet #EE82EE rgb(238, 130, 238)
Magenta #FF00FF rgb(255, 0, 255)
Pink #FFC0CB rgb(255, 192, 203)
Brown #A52A2A rgb(165, 42, 42)
Beige #F5F5DC rgb(245, 245, 220)