Free Online RGB to Hex

RGB-to-hex conversion packs three 0–255 channels (and optional alpha) into a compact hex string for CSS, design tools and code editors.

Your data is processed entirely in your browser and never sent to any server.

Instant results 100% private No signup needed
Hex output
#3B82F6
Formula

Each channel (0–255 decimal) is written as two base-16 digits: 0 → 00, 255 → FF, 128 → 80. The three pairs are concatenated and prefixed with #.

How to Use This Tool

  1. Drag each channel slider — Red, Green, Blue — or type a value 0–255 into the number input.
  2. Tick "Include alpha" and drag the Alpha slider if you need an 8-digit hex.
  3. Read the resulting hex string in the result panel.
  4. Click the copy icon to copy the hex to your clipboard.

What Is a RGB to Hex?

Going from `rgb(255, 87, 51)` to `#FF5733` is mechanical: each decimal channel becomes a two-digit base-16 number, the three pairs are joined, and a `#` is prefixed. With an alpha channel you get the 8-digit form CSS Color Module Level 4 accepts as `#RRGGBBAA`. The model itself is the additive sRGB space defined by IEC 61966-2-1.

The direction matters for workflow. Image editors and color-pickers in screenshot apps usually output RGB or rgb(); CSS, Tailwind, design-system tokens, JSON theme files and most code editors prefer hex. This converter is the bridge.

It accepts sliders, comma-separated values or three number fields, with an optional alpha slider for transparent overlays. The hex preview updates as you change any input.

Frequently Asked Questions

What RGB input is accepted?
Three numbers from 0–255, with an optional fourth (alpha, 0–1). Sliders make it easy, or type values directly.
Is the output with or without the # prefix?
The output includes the # by default because that is what CSS expects. You can also copy just the six digits if you need them for tooling that strips the hash.
How is RGB converted to hex?
Each channel's decimal value (0–255) is written as two base-16 digits and the three pairs are concatenated. 255 = FF, 0 = 00, 128 = 80.

Published by the WeGotEveryTool team. We build and test every tool in-house and update pages when the underlying spec, formula, or recommendation changes.

Reviewed: May 2026. Disclaimer: this tool is provided as-is for general informational use. For decisions with material consequences (medical, legal, financial, security) verify results against a qualified professional source.

Related Color & Design