Convert RGB & RGBA to Hex

Turn RGB triplets (0–255), percentages, or CSS rgba() strings into clean #RRGGBB and #RRGGBBAA hex codes immediately.

0 bytes sent
  • 100% browser-local
  • Zero server transfers
  • CSS Color 4 precision

or drop a color string, CSS/JSON snippet, or file here · Ctrl V to paste · Paste Hex, RGB, HSL, OKLCH or use Screen Eyedropper

Instant Before & After Specimen

6-digit & 8-digit Alpha HEX
Input Samplecobalt.rgb
rgb(37, 99, 235)
Expected OutputHEX
#2563EB

RGB vs HEX

Source vs. target format specification comparison
PropertySource: RGBTarget: HEX
Gamut scopesRGB (Standard Web)sRGB (Standard Web)
Perceptual uniformityNoNo
Alpha channel supportYesYes
Human readabilityMediumMedium
Extension / Token.css / .json.css / .txt
Best forPixel buffers, Canvas 2D shaders, and programmatic alpha opacity blendingCompact copy-paste handoff in sRGB brand guidelines and legacy CSS

How to use RGB to Hex

RGB to Hex — cleanly inside your local browser with zero server transfers.

  1. Enter or pick a colorType Hex, RGB, HSL, OKLCH, or Lab — or click Screen Eyedropper and live sliders.
  2. Inspect math & gamutReview exact CSS Color 4 readouts, sRGB vs Display P3 status, and profile options.
  3. Copy, chain, or exportCopy ready CSS/JSON snippets, download binary swatch files, or pipe directly to related Colr tools.

Frequently asked questions

How are non-100% alpha values encoded into Hex?

Alpha [0, 1] maps to a rounded 00–FF byte appended as digits 7 and 8 (#RRGGBBAA).

Can I toggle uppercase vs lowercase Hex output?

Yes — switch case formatting directly in the converter toolbar.