Color & CSS

Runs 100% locally in your browser

RGB to HEX Converter

Dial red, green, blue, and alpha channels to convert RGB values to exact HEX codes and CSS variables.

Presets
Switch to HEX to RGB

Live color swatch

Against Black (#000000)

7.49:1

AA Normal: PassAA Large: PassAAA: Pass
Against White (#FFFFFF)

2.80:1

AA Normal: FailAA Large: FailAAA: Fail

Converted color formats

Copy any CSS-ready representation with a single click.

HEX (6-digit)

#f97315

HEX (8-digit)

#f97315ff

RGB

rgb(249, 115, 21)

RGBA

rgba(249, 115, 21, 1)

HSL

hsl(25, 95%, 53%)

OKLCH

oklch(70.48% 0.1869 47.69)

CSS custom property

--brand-color: #f97315;

How to convert RGB and RGBA values to HEX color codes

How RGB channels convert to hexadecimal codes

Each integer channel from 0 to 255 maps to two base-16 digits from 00 to FF. When alpha is below 100%, the converter also emits an 8-digit HEX code (#RRGGBBAA) supported across all modern browsers.

Pasting CSS rgb() and rgba() strings directly

Adjust individual red, green, blue, and alpha sliders or paste a full CSS snippet such as rgb(50, 134, 220) or rgb(50 134 220 / 50%) directly into the input field to get HEX and HSL immediately.

RGB to HEX frequently asked questions

Are uppercase and lowercase HEX codes identical in browsers?
Yes. CSS treats #F97315 and #f97315 identically; toggle uppercase formatting to match your style guide.
How is alpha converted into the last two HEX digits?
Opacity between 0 and 1 is multiplied by 255, rounded to the nearest integer, and formatted as two hexadecimal digits.
Does this RGB to HEX tool send my colors to a server?
No. Everything runs locally in your browser with zero network requests.

Related tools

More browser utilities that run locally with zero uploads.

All tools

Instant AI

Launching a site with these assets?

Find a clean domain name and connect AI agents through Instant AI to research availability and launch faster.

Explore Instant