Skip to main content
CalcChef

RGB to Hex

Convert RGB to a hex color code and back: rgb(255, 136, 0) is #FF8800. Paste #abc, ff8800 or 255,136,0; each channel is a whole number 0 to 255. How it works

Use the RGB to Hex

Hex
#000000
RGB rgb(0, 0, 0)

#000000

rgb(0, 0, 0)

About the RGB to Hex

rgb(255, 136, 0) is #FF8800 in hex: each channel from 0 to 255 becomes two hex digits, red first, so 255 is FF, 136 is 88 and 0 is 00. To convert RGB to hex by hand, divide a channel by 16 and write the quotient and the remainder as hex digits.

CSS named colors in RGB and hex

Color nameRGBHex
blackrgb(0, 0, 0)#000000
whitergb(255, 255, 255)#FFFFFF
redrgb(255, 0, 0)#FF0000
limergb(0, 255, 0)#00FF00
bluergb(0, 0, 255)#0000FF
yellowrgb(255, 255, 0)#FFFF00
cyanrgb(0, 255, 255)#00FFFF
magentargb(255, 0, 255)#FF00FF
grayrgb(128, 128, 128)#808080
silverrgb(192, 192, 192)#C0C0C0
maroonrgb(128, 0, 0)#800000
greenrgb(0, 128, 0)#008000
navyrgb(0, 0, 128)#000080
purplergb(128, 0, 128)#800080
tealrgb(0, 128, 128)#008080
olivergb(128, 128, 0)#808000
orangergb(255, 165, 0)#FFA500
rebeccapurplergb(102, 51, 153)#663399

RGB values from the CSS Color Module Level 4 list of named colors; each hex code is the converter’s output for that RGB. CSS green is #008000; full-intensity green is lime.

What the hex field accepts

You type or pasteResult
#abc#AABBCC, rgb(170, 187, 204)
ff8800#FF8800, rgb(255, 136, 0)
rgb(255, 136, 0)#FF8800, rgb(255, 136, 0)
255,136,0#FF8800, rgb(255, 136, 0)
#12A hex code has 3 or 6 digits; this has 2.
#ff8800ccAlpha (#RRGGBBAA) is not supported: enter 3 or 6 hex digits.
rgb(256,0,0)Red is above 255: use a whole number from 0 to 255.

Frequently asked questions

How do I convert RGB to hex?
Write each channel as two hex digits: divide by 16, and the quotient is the first digit and the remainder the second, with 10 to 15 written A to F. rgb(102, 51, 153) gives 66, 33 and 99: #663399.
How do I convert hex to RGB?
Split the code into three pairs and turn each pair into decimal: in #808080 each pair is 8 × 16 + 0 = 128, so rgb(128, 128, 128). Paste the code into the hex field and the three channels fill in.
What is a 3-digit hex color?
A short form in which each digit is doubled: #abc means #AABBCC, rgb(170, 187, 204). The converter accepts it with or without the #.
Does the converter handle transparency (alpha)?
No. 8-digit codes such as #ff8800cc and rgba() values get a message; enter 6 digits or rgb() with three channels.
Why is my channel value rejected?
Each channel must be a whole number from 0 to 255. 256, -1 or 12.5 get a message rather than being clamped, so the hex code always matches what you typed.
Are hex color codes case sensitive?
No. CSS treats #ff8800 and #FF8800 as the same color. The converter prints capitals and accepts either case as input; if your style guide wants lowercase, lowercase the copied code.

Related Tools

View all tools