Skip to content
everylittletool

RGB to HEX Converter

Enter red, green and blue values to get the matching hex colour code.

Runs in your browser — nothing is uploaded

RGB

0–255

0–255

0–255

HEX

HSL

0–360°

0–100%

0–100%

#2F6FDE

RGB → HEX

#2F6FDE

How to use RGB to HEX Converter

  1. 1

    Type the Red, Green and Blue values, each from 0 to 255.

  2. 2

    Read the hex code in the HEX field and in the result beside the swatch.

  3. 3

    Click Copy HEX to copy it, ready for CSS or a design tool.

About this tool

To convert RGB to hex, write each channel as a two-digit base-16 number and join them. For rgb(255, 136, 0): 255 is FF, 136 is 8 × 16 + 8 = 88, and 0 is 00, so the result is #FF8800. Values below 16 need a leading zero, which is why 0 becomes 00 rather than 0.

The converter rounds decimals to the nearest whole number and only accepts 0 to 255 per channel; if a value is out of range, the swatch shows the last valid colour until you fix it. You can also edit the HEX or HSL fields, and the RGB values update to match.

Questions people ask

How do I convert RGB to hex by hand?

Divide each value by 16: the whole number is the first hex digit and the remainder is the second (10–15 become A–F). For 200: 200 ÷ 16 = 12 remainder 8, so C8.

What is the hex code for rgb(0, 0, 0) and rgb(255, 255, 255)?

Black is #000000 and white is #FFFFFF.

Can I use RGB percentages?

This page takes 0–255 values. To convert a percentage, multiply it by 2.55 first: 50% is about 128.

Similar shortcuts