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.

01 / Guide

How it works

Each red, green and blue channel is written as two hexadecimal digits in the order RRGGBB.

Good to know

The result has no alpha channel; this tool uses integer RGB and conventional HSL, not color-management profiles.

02 / Example

Example

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

03 / 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. For a concrete check, the example input rgb(42, 127, 220) produces #2A7FDC. Keep the original beside the result when comparing it with another application.

Understanding the color models

HEX and RGB describe the same three additive light channels. Each channel has an integer value from zero to 255, and hexadecimal writes that value with two base-sixteen digits. A six-digit code therefore has red, green and blue pairs in that order. HSL is another way to describe an RGB color: hue identifies a position on the color wheel, saturation controls distance from a gray of the same lightness, and lightness places the color between black and white. These forms are useful for comparing design tokens, reading CSS and adjusting a palette without guessing what a code means.

Choosing the right representation

The result has no alpha channel; this tool uses integer RGB and conventional HSL, not color-management profiles. Pick the form expected by the place where you will paste the result. CSS accepts both hex and rgb() or hsl() syntax, but a design system or graphics program may store channels separately. This tool uses ordinary sRGB arithmetic; it does not convert between display profiles or predict how every monitor will reproduce a color. Neither three-channel HEX nor these RGB and HSL outputs include transparency. A four- or eight-digit alpha code needs a separate operation. Integer RGB channels and displayed HSL decimals can also round, so a round trip may differ by one channel value.

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