Skip to main content
HSCalculadora

RGB to Hex Calculator

Convert RGB color values to a hex code.

0-255
0-255
0-255

Results update as you type.

Hex color code
—

How it works

Hex color codes are the standard way to specify colors in web design and CSS, and this calculator converts RGB values into a hex code. You enter the red, green, and blue values, each from 0 to 255, and it returns the six-digit hexadecimal color code. The conversion works because each color channel ranges from 0 to 255, which is exactly the range a two-digit hexadecimal number can represent (00 to FF), so each channel becomes two hex digits and the three are joined with a leading hash. For example, RGB (255, 165, 0) — a vivid orange — becomes #FFA500. Hexadecimal is base-16, using the digits 0-9 and letters A-F, which makes it a compact way to write the same values RGB expresses in decimal. Designers and developers use hex codes constantly in CSS, HTML, and design tools because they are concise and universally supported. Understanding the conversion helps you read and tweak colors directly — the first pair is red, the second green, the third blue, and higher values mean more of that color, so #FF0000 is pure red and #FFFFFF is white. This calculator makes it easy to translate a color picked in RGB into the hex format needed for the web. Enter the red, green, and blue values to get the hex code.

Formula

Convert each of R, G, B (0–255) to two hex digits and concatenate

Each red, green, and blue value from 0 to 255 is converted to a two-digit hexadecimal number, then the three pairs are joined and prefixed with a hash to form a six-digit hex color code. Hex is base-16, so 255 becomes FF and 0 becomes 00.

Source:Color representation (hex/RGB)

We review all our tools from time to time to ensure accuracy.

Worked example

Red:255Green:165Blue:0
R=255→FF, G=165→A5, B=0→00, giving the hex code #FFA500 (orange).

How to use this calculator

  1. 1

    Enter your values

    Enter red, green and blue.

  2. 2

    Adjust the options

    Fine-tune any options to match your situation.

  3. 3

    Read your result

    Hex color code updates instantly as you type — no button to press.

Frequently asked questions

How do you convert RGB to hex?

Convert each of the red, green, and blue values (0 to 255) into a two-digit hexadecimal number, then join them and add a hash prefix. For RGB (255, 165, 0), the channels become FF, A5, and 00, giving #FFA500. Each decimal value from 0 to 255 maps exactly to a two-digit hex value from 00 to FF.

What is a hex color code?

A hex color code is a six-digit hexadecimal representation of a color, written with a leading hash like #FFA500. The first two digits are red, the next two green, and the last two blue, each ranging from 00 to FF. Hex codes are the standard for specifying colors in web design, CSS, and most design software.

Why is hexadecimal used for colors?

Hexadecimal is base-16, so each color channel's full 0-to-255 range fits neatly into two digits, making a color a compact six-character code. This is more concise than writing three decimal numbers and is universally supported in web and design tools. Hex codes are easy to copy, share, and embed in stylesheets, which is why they became the web standard.

What do the hex digits mean?

The six digits are three pairs: red, green, and blue, each from 00 (none) to FF (maximum, which is 255 in decimal). So #FF0000 is pure red, #00FF00 pure green, #0000FF pure blue, #000000 black, and #FFFFFF white. Reading the pairs lets you understand and adjust a color directly by changing how much of each channel it contains.

Can I convert hex back to RGB?

Yes. To go from hex to RGB, split the six-digit code into three two-digit pairs and convert each from hexadecimal back to a decimal number from 0 to 255. For example, #FFA500 becomes red 255, green 165, blue 0. Many color tools convert both directions, and the process is simply the reverse of the RGB-to-hex conversion.