DevSwitch.net

Resetting tool...

Back to Tools
#FF

RGB to HEX Converter

Convert RGB color values to hexadecimal format

Color Tools

Accepts: RGB (0-255 or 0-1 decimal), comma/space separated, or rgb() format

Runs in your browser

Quick Colors:

Preview & Output

Click swatch to open native picker

Fine-tune Color

Adjust each channel independently

Convert RGB values to a hex color code

Type or paste an RGB color, such as 255, 136, 0 or rgb(255, 136, 0), and the RGB to HEX converter shows the hex code as you type: #FF8800. The swatch shows the color, and the sliders change one channel at a time.

The result is always six uppercase digits with a # in front, ready for CSS, HTML, SVG or a design tool. Copy it with the button next to the value, or click the value itself.

How RGB to hex conversion works

Each channel, 0 to 255, becomes two base-16 digits. For rgb(255, 136, 0):

ChannelDecimalDivided by 16Hex
Red 255 15 remainder 15 FF
Green 136 15 remainder 15 88
Blue 0 15 remainder 15 00

The quotient and the remainder are the two digits, with 10 to 15 written as A to F. Put the pairs in order, red, green, blue, and add a #: #FF8800. A channel below 16 needs a leading zero, so 9 is written 09.

In JavaScript it's one line: '#' + [r, g, b].map(v => v.toString(16).padStart(2, '0')).join(''). For numbers above 255, the decimal to hex converter shows the same division step by step.

RGB formats the converter reads

Commas or spaces, with or without rgb(). Each line below gives the hex code on the right:

  • Input

    255, 136, 0 · 255 136 0

    Result

    Three channels from 0 to 255 give #FF8800. Decimals are rounded, and values above 255 are capped at 255.

  • Input

    rgb(255, 136, 0) · rgba(255, 136, 0, 0.5)

    Result

    The CSS forms, as DevTools copies them, give #FF8800. The alpha value of rgba() is ignored.

  • Input

    1, 0.5, 0

    Result

    When all three numbers are 1 or less, they are read as 0 to 1 fractions, as shaders and some design tools write them: #FF8000.

  • Input

    rgb(255 136 0)

    Result

    The newer CSS syntax without commas isn't read yet. Leave out the rgb() around the numbers, or add commas.

Short codes, transparency and HSL

  • Three-digit codes

    #FF8800 can also be written #F80, because each pair repeats one digit. The converter always writes all six digits; shorten a code by hand only when every pair is a double.

  • Colors with opacity

    An 8-digit code keeps the opacity in its last pair: #FF880080 is #FF8800 at about 50%. To see RGBA and HEX next to each other, use the color picker with its alpha slider.

  • Lighter or darker in HSL

    To change lightness or saturation instead of channels, HSL is easier to edit by hand. The reasons are in why developers switch from RGB to HSL.

Going the other way?

Paste a code like #FF8800 and get 255, 136, 0 back, as rgb() and as plain numbers.

RGB to HEX questions

When all three numbers are 1 or less, the box reads them as 0 to 1 fractions, so 1 means full red. To enter a very dark channel such as 1, type it in the number box next to the slider instead.

No. #ff8800 and #FF8800 are the same color in CSS and HTML. The converter writes uppercase.

It is dropped: rgba(255, 136, 0, 0.5) gives #FF8800. For an 8-digit code, convert the alpha to a pair yourself: 0.5 × 255 rounds to 128, which is 80 in hex, so #FF880080.

Click the swatch to open your browser's color picker. In Chrome and Edge it has an eyedropper that samples any pixel on the screen, and the RGB and HEX values follow your pick.

No. The conversion runs in your browser as you type.