← Zaps Colors
Converter

RGB to HEX Converter

Enter red, green and blue values from 0 to 255, or paste an rgb() value, to get the HEX code. It updates as you type.

RGB values

Whole numbers from 0 to 255

HEX#26A69A
hex#26a69a
ShortNo short form

What this RGB to HEX converter does

It turns red, green and blue numbers into the HEX code that CSS, Figma, Sketch and most design tools ask for. Type the three values into R, G and B, or paste one of these into the box:

Values must be whole numbers from 0 to 255. Anything else gets an inline message and the last good result stays on screen. Every color has its own link, so you can send a result to a teammate with the Copy link button.

How RGB becomes HEX

Each channel is one byte, and a byte is exactly two hexadecimal digits. Convert the three channels separately, pad each to two digits, and put a # in front.

R  38   =  2 × 16 + 6    =  26
G  166  = 10 × 16 + 6    =  A6
B  154  =  9 × 16 + 10   =  9A

rgb(38, 166, 154)  =  #26A69A

If you write the conversion in code, the same thing is one line of JavaScript:

const hex = '#' + [r, g, b]
  .map((v) => v.toString(16).padStart(2, '0'))
  .join('');

The padStart call is the part people forget. Without it, a channel of 9 gives 9 instead of 09 and the code ends up the wrong length.

Landmark values

DecimalHEX pairWhat it means
000Channel fully off
6440A quarter of full brightness
12880About half
192C0Three quarters
255FFChannel fully on

Need to go the other way, or want alpha? Use the HEX to RGB converter. To see what a code is called, try the color name finder.

Related color tools

RGB to HEX FAQ

How do I convert RGB to HEX?

Write each of the three values in base 16 as two digits and join them after a #. For rgb(38, 166, 154), 38 is 26, 166 is A6 and 154 is 9A, so the HEX code is #26A69A. This converter does that for you as you type.

Why does a value like 9 become 09?

Every channel needs exactly two HEX digits. A value below 16 has only one digit in base 16, so it is padded with a leading zero. rgb(9, 9, 9) is #090909. Dropping the zero would shift the digits and give a different color.

Should I write HEX in uppercase or lowercase?

Browsers and design tools read both the same way. #ff922e and #FF922E are one color. Pick one style and keep it across a project so searches and diffs stay tidy. The tool shows both so you can copy whichever your style guide uses.

What if my RGB values have decimals or percentages?

This converter takes whole numbers from 0 to 255. If a value is a percentage, multiply it by 2.55 and round, so 50% becomes 128. If it has a decimal, round it first. Anything outside 0 to 255 is flagged instead of being clamped.

When does a color have a short 3-digit HEX code?

Only when each of the three pairs repeats one digit, such as #FFAA00, which shortens to #FA0. In decimal that means every channel is a multiple of 17. The Short row appears when a short form exists and says so when it does not.

How do I add transparency to a HEX code?

Add two more digits for opacity, for example #26A69A80 for about 50%. This page outputs the opaque 6 digit code. The HEX to RGB converter handles alpha and gives you the matching rgba() value.

Put these colors to work

Pick a Zaps template for your next post, story or reel, add your photos and match it to your palette.