Free · No signup · Nothing uploads

RGB to Hex Converter

Three channel numbers in, one shareable hex code out.

Last updated: November 1, 2026

  1. 1Pick a colorPress C, or drop an image
  2. 2Copy it as…HEX, RGB, CSS, Tailwind
  3. 3Build the paletteRamps, contrast, tokens

Pick a color

From anywhere on your screen, straight out of an image, or by typing any CSS color.

Or start from the current color

Color inspector

Every notation at once — click any row to copy it.

#10B981

Light cool green-cyan

Best text on this fill

#111827 · 6.99:1

Light fill — near-black ink carries body copy here.

Copy it as

tap a box to copy

Everything in this picker — tap to open

Is it readable? (WCAG 2.2)

Ratio, pass/fail for every threshold, and a fix that changes only lightness so the hue stays yours.

Text

Background

Ratio

2.54:1

ΔL* 33.2 · ΔL(ok) 30.4

The quick brown fox jumps over 13 lazy dogs.

Body copy at 13px — this is the size most interface text ships at, so the AA threshold is the one that matters.

Button labelInline link
  • Body text · AA≥4.5:1
  • Body text · AAA≥7:1
  • Large text · AA≥3:1
  • Large text · AAA≥4.5:1
  • UI & icons · AA≥3:1

Fails AA for body text (2.54:1 vs the 4.5:1 requirement). Minimum comfortable size at this ratio: 24px. APCA — the perceptual model proposed for WCAG 3 — is not a legal requirement yet, and rules like the EU Accessibility Act reference WCAG 2.x, so this tool scores against WCAG 2.2 and reports the perceptual lightness gap alongside it.

Pure-black ink on this background: 19.64:1 · pure-white ink: 1.00:1

Everything runs locally: the eyedropper uses your browser's own EyeDropper API, image sampling reads a canvas buffer in this tab, and nothing is uploaded, watermarked or logged.

#10B981tap to copy this color

Quick answer

Enter the red, green and blue values (0-255) or paste rgb(243, 106, 29) and the hex code appears immediately: each channel becomes a two-digit base-16 pair, so 243/106/29 is #F36A1D. Drag the sliders to watch both change, and copy rgb(), hsl(), oklch() or the CSS variables in one click.

About this tool

Design tools, native SDKs, canvas APIs and shader code all speak RGB; CSS, Figma tokens and most brand guides speak hex. Converting between them is a rounding exercise people get wrong under pressure — a 3-digit collapse, a missing leading zero, or an alpha channel silently dropped. This page keeps both views side by side, so the number you type and the string you paste can never disagree. It also reports whether the color fits sRGB or only exists in a wider gamut, which matters when you push a value out of oklch() or color(display-p3).

How it works

Three steps, about a minute, no account.

1

Type the channels

Paste rgb()/rgba() or set R, G and B yourself.

2

Check the swatch

The big preview plus the best text color and its contrast ratio.

3

Copy the hex

Hex, hex+alpha and every other notation are one click each.

Why this version is different

Live Sliders

Hue, saturation and lightness with gradient tracks.

Zero-Safe Output

Always six digits, leading zeros included.

Alpha Aware

Keeps 0-1 opacity and writes 8-digit hex when needed.

Gamut Warnings

Tells you when an OKLCH or P3 input fell outside sRGB.

Perceptual Editors

OKLCH lightness and chroma sliders for even visual steps.

Frequently asked questions

Why is my hex code missing a digit?

Values under 16 need a leading zero — 9 becomes 09. A three-pair converter that skips it produces an invalid code; this one always pads to six digits.

Can I convert rgba to hex with alpha?

Yes. The alpha channel becomes the final pair, so rgba(243, 106, 29, 0.5) outputs #F36A1D80 for browsers that support 8-digit hex.

Which RGB values should I use for web text?

Anything readable on its background: target 4.5:1 contrast for body text under WCAG 2.2, which the contrast tab scores for you.

Does it handle out-of-range values?

Values are clamped to 0-255 and the tool tells you when clamping happened, so a bad paste never quietly changes your color.

Want the whole workspace instead of this one panel? The full online color picker adds harmonies, tonal scales, extraction, gradients, the mixer and color-blindness checks.