Skip to content

RGB to HEX Converter

Popular
File Conversion Toolsβ€’Client-Side & Private

Convert RGB (0–255) and optional RGBA alpha values to 6-digit (#RRGGBB) and 8-digit (#RRGGBBAA) HEX codes, with a live preview.

Tool workspace

Convert RGB (0–255) and optional RGBA alpha values to 6-digit (#RRGGBB) and 8-digit (#RRGGBBAA) HEX codes, with a live preview.

HEX Code (6-digit)#0080FF
CSS Declarationrgb(0, 128, 255)
Need the reverse conversion?

Convert a 6-digit or 3-digit HEX code back into standard decimal RGB values.

HEX to RGB

Loading tool controls…

Files processed locally β€” never uploaded to our servers
Free Instant Private

Verify it yourself: press F12, open the Network tab, and use this tool β€” your files are never uploaded.

RGB to HEX Converter at a glance

Price
Free
Account
Not required
File uploads
None β€” your files are never uploaded

Who uses File Conversion Tools?

Anyone converting files between formats β€” images, data, encodings and colour values.

How to Use RGB to HEX Converter

Follow these simple steps to get instant results in your browser.

1

Set RGB channels

Enter red, green and blue values in the accepted 0–255 range.

2

Choose transparency

Keep alpha at 1 for opaque color or enter a value from 0 to 1.

3

Convert and copy

Calculate the output, inspect the preview and copy the desired HEX representation.

4

Copy the format you need

Copy the six-digit code for an opaque colour, or the eight-digit RRGGBBAA code when you set an alpha below 1.

πŸ’‘

What is RGB to HEX Converter & How Does It Work?

Convert red, green and blue channels from 0 to 255 into a six-digit HEX color. Add an alpha value from 0 to 1 when you need an eight-digit color. The tool shows the calculated swatch and copyable output after conversion.

HEX stores the same channel values in base 16; it does not improve a color or apply a display profile. Alpha is quantized to an 8-bit value, so its HEX representation can only approximate arbitrary decimal transparency. For example, alpha 0.5 rounds to 128, written 80. Eight-digit CSS HEX uses RRGGBBAA order, with alpha at the end.

The anchors are worth knowing by heart. White rgb(255, 255, 255) is #FFFFFF and black rgb(0, 0, 0) is #000000 β€” every channel at its maximum or minimum. Orange rgb(255, 128, 0) is #FF8000: 255 is FF, 128 is 80 and 0 is 00, each channel written as exactly two hexadecimal digits with a leading zero where necessary.

Alpha is where the approximation lives. Alpha 0.75 gives a byte of round(0.75 Γ— 255) = 191, written BF β€” so orange at 75% opacity is #FF8000BF in eight-digit RRGGBBAA order. But 191 out of 255 is 74.9%, not exactly 75%: an 8-bit byte has only 256 possible values, so a decimal transparency is always rounded to the nearest one. Alpha 0.1 rounds the same way to 26, written 1A.

⚑

Key Features & Capabilities

βœ“

Opaque and alpha formats

Inspect six-digit and eight-digit output for CSS work.

βœ“

Validated channels

Checks channel ranges before converting.

βœ“

Eight-digit RRGGBBAA

With an alpha below 1, the code carries the alpha byte at the end β€” #FF8000BF for orange at 75% opacity.

βœ“

Two-digit padding

Every channel is written as exactly two hex digits, with a leading zero where necessary β€” 0 becomes 00, not 0.

Pro Tips

  • β€’Bookmark this tool for instant one-click access anytime.
  • β€’Drag and drop files directly onto the input surface for fastest handling.
  • β€’All processing happens in your browser session for maximum speed and data safety.

🎯 Common Use Cases

CSS tokensTranslate RGB specifications into a HEX color value.
Transparency checksInspect the alpha byte used by eight-digit colors.
Design handoffCopy HEX values from a design specification into CSS.
Semi-transparent orangeOrange #FF8000 at 75% opacity is #FF8000BF β€” the alpha byte BF is round(0.75 Γ— 255) = 191, about 74.9%.
White and black tokensWhite is #FFFFFF and black is #000000 β€” the two anchors every palette starts from.
πŸ“

RGB bytes to hexadecimal

Formula Equation:
HEX = # + hex(R) + hex(G) + hex(B); alpha byte = round(alpha Γ— 255)

Write each channel as two hexadecimal digits, padding a leading zero where necessary.

✏️

Worked Example

  1. 1RGB 255,128,0 β†’ FF,80,00 β†’ #FF8000
  2. 2Alpha 0.5 β†’ byte 128 β†’ #FF800080
  3. 3RGB 255,255,255 β†’ #FFFFFF; RGB 0,0,0 β†’ #000000
  4. 4Alpha 0.75 β†’ byte 191 β†’ #FF8000BF (eight-digit, RRGGBBAA)
πŸ“š

Sources & Further Reading

Frequently Asked Questions about RGB to HEX Converter

Frequently asked questions

Each RGB channel (0–255) is converted to a 2-digit base-16 hexadecimal number, padded with a leading zero if necessary, and concatenated with a leading '#' symbol. For example, RGB(0, 128, 255) converts to R=00, G=80, and B=FF, resulting in #0080FF.

The alpha channel value (0 to 1) is multiplied by 255 and rounded to the nearest integer. That number is then converted to a 2-digit hexadecimal byte and appended to the 6-digit HEX value (#RRGGBBAA). For example, alpha 0.5 becomes 128 (80 in hex), giving #FF000080.

No. Standard 24-bit sRGB color channels are discrete 8-bit integers ranging from 0 to 255. Non-integer decimal numbers (such as 12.5) are rejected with a field error.

The 3-digit form is a shorthand: each digit is doubled, so #F80 means #FF8800. This tool always outputs the full 6-digit form (or 8-digit with alpha), which every browser and design tool accepts.

Yes β€” use the companion HEX to RGB tool on this site. It takes a #RRGGBB code and returns the three 0–255 channel values, with the same live preview.

White is #FFFFFF β€” every channel at its maximum of 255, which is FF in hexadecimal. Black is the opposite: #000000, every channel at 0.

191, written BF. The alpha byte is round(0.75 Γ— 255) = 191, so orange at 75% opacity is #FF8000BF in eight-digit RRGGBBAA order β€” the alpha byte goes at the end.

Because an 8-bit byte has only 256 possible values, so a decimal transparency is always rounded to the nearest one. 191 out of 255 is 74.9%, not exactly 75% β€” the HEX code approximates the transparency, it does not store it exactly.

Complementary utilities for your workflow

View all β†’
You are here

RGB to HEX Converter

Convert RGB and RGBA color codes to 6-digit and 8-digit HEX.

Current tool

HEX to RGB

Convert HEX color codes to RGB parameters.

Try tool

RGB to CMYK

Convert RGB parameters to CMYK models.

Try tool

HEX to HSL

Convert HEX color codes to HSL parameters.

Try tool

HSL to HEX

Convert HSL parameters to HEX codes.

Try tool