RGB to HEX

Convert RGB color values to HEX color codes.

Convert an RGB colour to its HEX code: rgb(255, 87, 51) becomes #FF5733. Type values as rgb(…), as three numbers separated by spaces or commas, or several colours one per line, and each one is converted with a swatch so you can check it. RGBA colours with transparency become 8-digit HEX. Below the result you also get the same colour in HSL, HSV, CMYK and the nearest CSS colour name.

HEX

#FF5733

HEX#FF5733
RGBrgb(255, 87, 51)
HSLhsl(11, 100%, 60%)
HSV / HSBhsv(11, 80%, 100%)
CMYKcmyk(0%, 66%, 80%, 0%)
CSS nametomato (closest)

Common use cases

  • Get a HEX code for CSS from RGB values in a design tool
  • Convert brand colours given in RGB for a website
  • Batch-convert a palette, one colour per line
  • Check a colour's HSL or CMYK values at the same time

How to use

  1. Type an RGB colour, or several on separate lines.
  2. Read the HEX code next to each swatch.
  3. Copy the code, or use the other formats in the table.

FAQ

How is RGB converted to HEX?

Each channel (0 to 255) is written as a two-digit hexadecimal number: 255 is FF, 87 is 57 and 51 is 33, giving #FF5733.

What about transparency?

An alpha value (rgba) adds two more hex digits, so 50% opacity becomes 80 on the end: #FF573380.

Why is the CMYK value only approximate?

Printed colour depends on ink and paper. The CMYK figure here is a simple conversion; for print work, use your printer's colour profile.