HCODX/RGB to HEX
100% browser-based · Batch conversion · rgb / rgba / bare

RGB to HEX

Convert RGB color values to HEX in your browser. Accepts rgb(...), rgba(...), and bare comma-separated values. Eight-digit HEX is emitted when alpha is present.

RGB colors
HEX codes
Convert options
Reverse (HEX → RGB)
Input size
0 B
Output size
0 B
Colors
0
Status
Ready
Example

RGB in, HEX out

Functional rgb() / rgba() notation and bare channel tuples both work. Alpha is preserved in the 8-digit HEX form.

RGB input
rgb(59, 130, 246)
rgba(255, 0, 0, 0.5)
16, 185, 129
rgb(0, 0, 0)
HEX output
#3B82F6
#FF000080
#10B981
#000000
Use cases

What you'll use this for

RGB shows up everywhere — DevTools, Pillow / OpenCV, design specs. HEX is what most stylesheets and design tools want back.

CSS authoring

Normalize RGB values pulled from a debugger or palette into HEX for your stylesheet.

Design system docs

Convert raw channels emitted by a generator into the HEX format your docs reference.

Brand audits

Collapse a mix of rgb() and tuples from many sources into a canonical HEX list.

Tooling

Feed HEX into design tools, JSON theme files, and color libraries that don't accept RGB strings.

Step by step

How to convert RGB to HEX

1

Paste your RGB list

One color per line. rgb(r, g, b), rgba(r, g, b, a), or bare r, g, b tuples all work.

2

Pick options

Choose case (upper/lower) and whether to keep alpha in the 8-digit HEX form.

3

Click Convert

Or leave auto-convert on for live updates. Everything runs in your browser.

4

Copy or download

Copy to clipboard or save as .txt. Or hop to HEX to RGB for a round-trip.

FAQ

Frequently asked questions

rgb(r, g, b), rgba(r, g, b, a), and bare comma- or space-separated r, g, b values. Alpha is preserved when present. Whitespace and the alpha-with-slash syntax (rgb(59 130 246 / .5)) are tolerated.

Yes. Paste one RGB color per line. Each is converted independently and the HEX results are emitted in the same order.

Yes. No signup, no limits, no ads. Runs entirely in your browser.

With "Include alpha" on, rgba() input is converted to 8-digit #RRGGBBAA HEX. Turn it off to drop alpha and emit a 6-digit HEX instead. rgb() input has no alpha to start with.

Use HEX to RGB for the opposite direction. Or Color Picker if you want every format at once.

About

About HEX color notation

HEX (#3B82F6) is base-16 RGB: two hex digits each for red, green, and blue, giving 256 levels per channel. The 8-digit form (#3B82F680) adds a fourth pair for alpha — 0–255, where FF is fully opaque.

Channel math

  • RGB (59, 130, 246) → 59 = 3B, 130 = 82, 246 = F6#3B82F6.
  • RGBA (255, 0, 0, 0.5) → alpha 0.5 × 255 ≈ 128 = 80#FF000080.
  • Three-digit shorthand (#3BF) expands each digit (= #33BBFF) — emitted only when each channel is a pair of equal digits and shorthand is requested.

Browser support

Six-digit HEX is supported everywhere. Eight-digit HEX with alpha works in all evergreen browsers and Safari 9.1+. If you need to support very old IE, use rgba() instead.

Related

Related tools