RGB to hex converter

Press / to edit
Black text 9.92:1#12C2E9

Result

HEX#12C2E9
RGBrgb(18, 194, 233)
HSLhsl(191, 86%, 49%)
HSVhsv(191, 92%, 91%)
CMYKcmyk(92%, 17%, 0%, 9%)
OKLCHoklch(75.33% 0.1346 219.54)
LABlab(72.62 -26.21 -30.54)

Move the red, green and blue sliders and read the matching hex code instantly. HueKit also shows HSL, HSV and CMYK so you have every format at once.

Try an example
Grow a palette

Select any swatch to convert it.

Open in palette generator
Shades and tints
Complementary
Analogous
Triadic
Batch colors

Paste several hex codes, one per line or comma-separated. Each one becomes a swatch you can copy, and the set can be saved as a palette.

Converting RGB to hex

RGB describes a color as three numbers from 0 to 255: how much red, green and blue light to mix. Hex packs those same three numbers into a six character string. Each channel becomes two hex digits, and they are written in the order red, green, blue after a hash.

To convert a channel by hand you divide by 16 for the first digit and take the remainder for the second. So 235 becomes EB, because 235 is 14 times 16 plus 11, and 14 is E while 11 is B. HueKit runs that for all three channels the instant you change a value.

Why designers hand off hex

Hex is compact and unambiguous, which is why it dominates CSS and design files. RGB is more useful when you are doing math on colors in code, for example blending pixels on a canvas. Since they are the same color in two notations, you can move freely between them. If you need the reverse direction, use the hex to RGB converter.

A worked example

Starting from rgb(37, 99, 235):

  1. Write each channel as two base 16 digits, then join them after a hash
  2. Red: 37 = (2 x 16) + 5 = 25
  3. Green: 99 = (6 x 16) + 3 = 63
  4. Blue: 235 = (14 x 16) + 11 = EB

Result: #2563EB

Exact in both directions. A three digit shorthand only exists when both digits of every pair match.

Frequently asked questions

How do I convert RGB to hex?

Take each channel value from 0 to 255 and write it as a two digit base 16 number, then join red, green and blue with a leading hash. HueKit does this instantly as you move the sliders.

Why is 255 written as FF in hex?

Hex is base 16, so two digits cover 0 to 255. FF is 15 times 16 plus 15, which equals 255, the maximum for a single channel. That is why full white is FFFFFF.

Are RGB and hex the same color?

Yes. Hex is simply a shorter way to write the same three RGB channels, so rgb(37, 99, 235) and #2563EB describe exactly the same color.

Related tools

Last updated by FusionStudios. Every value on this page is computed by the same functions the tools use. How this is calculated.