Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Hex Color Code
#FF6347
rgb(255, 99, 71)
Red 255
Green 99
Blue 71

What Is an RGB to Hex Converter?

This tool converts a color expressed in the RGB model — three channels of Red, Green, and Blue each ranging from 0 to 255 — into a hexadecimal color code of the form #RRGGBB. Hex codes are the standard way to specify colors in HTML, CSS, design software, and most digital tools, so converting RGB values to hex is an everyday task for web developers and designers.

RGB channels combining into a single color with its hex code
Red, green and blue channel values combine into one color represented by a hex code.

How to Use It

Enter your Red, Green, and Blue values, each between 0 and 255. Click calculate and the tool returns the matching hex code plus a live color swatch so you can confirm the result visually. Values outside 0-255 are automatically clamped to the valid range.

The Formula Explained

Each channel is an integer from 0 to 255, which is exactly the range a single byte can hold (00 to FF in hexadecimal). The converter formats each channel as a two-digit, zero-padded uppercase hex number and joins them:

$$\text{Hex} = \text{\#} \; \texttt{[}\text{Red}\texttt{]}_{16} \, \texttt{[}\text{Green}\texttt{]}_{16} \, \texttt{[}\text{Blue}\texttt{]}_{16}$$

For example, the value 255 becomes FF, and 0 becomes 00. Mathematically a channel value v splits into a high digit \(\lfloor v/16 \rfloor\) and a low digit \((v \bmod 16)\).

One color channel value 0 to 255 mapping to a two-digit hex pair 00 to FF
Each 0-255 channel value maps to a two-character hex pair from 00 to FF.

Worked Example

Take "tomato" red: R = 255, G = 99, B = 71. 255 in hex is FF. 99 is \(6 \times 16 + 3 = 63\). 71 is \(4 \times 16 + 7 = 47\). Concatenating gives #FF6347 — the standard CSS "tomato" color.

FAQ

What does each hex pair mean? The first pair is red, the second green, the third blue — each from 00 (none) to FF (full).

Why uppercase? Hex codes are case-insensitive; uppercase is a common convention but #ff6347 is equally valid.

Can I enter decimals? No — RGB channels are whole numbers from 0 to 255. Fractional values are rounded down.

Last updated: