Skip to content

Convert RGB to HEX: color code converter

Type your RGB values, for example 230, 88, 23, and instantly get the hex code for CSS, plus HSL, CMYK, LAB and more formats. It also works the other way round.

#
#2C71DErgb(44, 113, 222)

RGB channels

  • Red2C → 44
  • Green71 → 113
  • BlueDE → 222

Or pick the color visually

Color Conversion

RGB to HEX color chart

The most looked-up colors with their RGB value and hex code. Click one to load it into the converter.

ColorHEXRGB
#FFFFFFrgb(255, 255, 255)
#000000rgb(0, 0, 0)
#FF0000rgb(255, 0, 0)
#00FF00rgb(0, 255, 0)
#0000FFrgb(0, 0, 255)
#FFFF00rgb(255, 255, 0)
#00FFFFrgb(0, 255, 255)
#FF00FFrgb(255, 0, 255)
#FFA500rgb(255, 165, 0)
#800080rgb(128, 0, 128)
#FFC0CBrgb(255, 192, 203)
#A52A2Argb(165, 42, 42)
#808080rgb(128, 128, 128)
#C0C0C0rgb(192, 192, 192)
#000080rgb(0, 0, 128)
#808000rgb(128, 128, 0)

How an RGB color converts to Hex

Each RGB channel is a decimal number from 0 to 255. To convert it to Hex, that number is turned into base 16, giving a two-character value per channel, from 00 to FF. The three pairs are joined in red, green, blue order to form the full Hex code.

For example, the color rgb(230, 88, 23) converts like this:

  • 230E6red
  • 8858green
  • 2317blue
#E65817

The result is #E65817. It is exactly the reverse of what the Hex to RGB converter does.

  • 230 ÷ 16 = 14 (E), remainder 6 → E6
  • 88 ÷ 16 = 5, remainder 8 → 58
  • 23 ÷ 16 = 1, remainder 7 → 17

The formula, step by step

Divide each value by 16: the quotient is the first character of the pair and the remainder the second. Numbers 10 to 15 are written as letters: A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.

HEX and RGB formats CSS accepts

The same color can be written in several ways. All of them work in current browsers, and the converter understands any of them.

  • 6-digit HEX

    The most common format: two characters per channel, in red, green and blue order. Upper or lower case makes no difference.

  • Short HEX (3 digits)

    When each pair repeats its character, it can be shortened: #FF6600 becomes #F60.

  • HEX with transparency (8 digits)

    The last two characters are the alpha channel: 00 is transparent and FF opaque. 80 is about 50%.

  • rgb() with commas

    The classic syntax, supported by every browser. Each channel goes from 0 to 255.

  • Modern rgb()

    The CSS Color 4 syntax: space-separated values and optional transparency after the slash. rgba() still works as an alias.

Explore your color on the color wheel

With Hex ready, open the color wheel to generate harmonies, or browse names and codes in the HTML colors list.

FAQ

Each of the three RGB values (from 0 to 255) is converted to base 16, giving a two-character number per channel. The three pairs are joined in red, green, blue order to form the Hex code.

The hexadecimal system uses digits 0–9 and letters A–F to represent values from 10 to 15. That is why the final Hex code can include both.

It is not a valid value. Each RGB channel only accepts numbers from 0 to 255, the full range a byte can represent.

Yes. The converter accepts 230, 88, 23, 230 88 23, rgb(230, 88, 23), rgb(230 88 23) and rgba(…). Any transparency is ignored to calculate the 6-digit HEX.

Yes. Use the Hex to RGB converter for the reverse process: enter your hexadecimal code and get the three matching RGB values.

A shorthand that works when each pair repeats its character: #F60 equals #FF6600 and #FFF equals #FFFFFF. The converter accepts both.

Add two more characters at the end: the alpha channel. #E6581780 is the same orange at 50% opacity; 00 is fully transparent and FF opaque.

Related tools