Text & code / MULTIVERTO

RGB to HEX color

Turn three integer RGB channels into a six-digit hexadecimal web color.

Live converterYour input stays in this browser. No text is uploaded for conversion.

The file stays in your browser.
Chain tools

Apply each text tool to the previous result. Text workflows ↗

Only the recipe name and tool order are saved in this browser. Your input and results are never saved.

01 / Example

Example

Your inputrgb(42, 127, 220)
Result#2A7FDC

02 / Guide

RGB to HEX color — How it works

Packing RGB channels into hex

Turn three integer RGB channels into a six-digit hexadecimal web color. Choose this tool when an inspector, drawing application or calculated color provides red, green and blue channels but a stylesheet needs a compact hex token. You may enter rgb(42, 127, 220) or simply three comma-separated channel integers. The converter does not accept percentages, fractional channels or a fourth alpha value.

Each red, green and blue channel is written as two hexadecimal digits in the order RRGGBB. Channel 42 is 2A in base sixteen, 127 is 7F and 220 is DC, giving #2A7FDC. Every channel uses exactly two digits, including a leading zero for values below sixteen. Hex letter case does not change the color, although the output uses uppercase for consistency.

Understanding the color models

Think of the output as three two-digit channel fields joined after #. The input must supply three whole-number channels; a percentage or opacity value needs a different input contract. A four- or eight-digit alpha code needs a separate operation.

Choosing the right representation

For example, red 0, green 16 and blue 255 produce #0010FF: the zero pair matters because otherwise the boundaries between channels disappear. Do not scale values from percentages by eye; this input expects integers, so convert percentages deliberately before entering them. A pasted HEX token can be checked by decoding it back to the original RGB triplet. That round trip validates the arithmetic, although it says nothing about monitor calibration or accessibility contrast against a background. If opacity matters, keep it in a separate field.

For a concrete check, the example input rgb(42, 127, 220) produces #2A7FDC. Examine each two-digit pair in the result before copying it into CSS or a design token. A channel with a small value still needs its leading zero, or the later channels will move to the wrong positions. Returning this hex value through HEX-to-RGB should recover the original integer channels. That test verifies the notation, while the apparent shade on a monitor remains a separate visual check. Enter the red, green and blue channels in the order requested and verify their boundaries before copying the six-digit result. In a design handoff, compare the generated code with the original channels in the same color space; a preview can differ across screens even when the numbers agree. If an asset includes opacity, record the alpha value separately or use a format that explicitly carries it. A later conversion from HEX should restore the integer channels exactly, while an intermediate HSL edit may involve rounding. Preserve the original channel values for automated visual regression checks.

How this conversion transforms the input
RGB color
Colour channels
HEX color

Explore guides

Conversion guides

Explore guides