Color & CSS

Runs 100% locally in your browser

HEX to RGB Converter

Translate hexadecimal color codes to RGB, RGBA, and HSL with live preview and WCAG contrast ratios.

Presets
Switch to RGB to HEX

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.

RGB

rgb(249, 115, 21)

RGBA

rgba(249, 115, 21, 1)

HSL

hsl(25, 95%, 53%)

OKLCH

oklch(70.48% 0.1869 47.69)

HEX (6-digit)

#f97315

HEX (8-digit)

#f97315ff

CSS custom property

--brand-color: rgb(249, 115, 21);

How to convert HEX color codes to RGB, RGBA, and HSL

Understanding 3, 4, 6, and 8-digit HEX color codes

Standard 6-digit HEX strings encode red, green, and blue channels as two hexadecimal digits each from 00 to FF (0 to 255). Shorthand 3-digit codes double each digit (#f80 becomes #ff8800), while 4-digit and 8-digit HEX codes append an alpha transparency channel.

Using RGB, RGBA, and WCAG contrast checks in CSS

Modern CSS supports space-separated rgb(249 115 21 / 0.8) syntax alongside legacy comma-separated rgba(). Checking WCAG contrast against both black and white surfaces helps you choose accessible text colors before shipping your palette.

HEX to RGB frequently asked questions

Does this HEX to RGB converter support transparency?
Yes. Paste 4-digit (#RGBA) or 8-digit (#RRGGBBAA) HEX values to extract the alpha channel as both a decimal opacity and percentage.
What contrast ratio is required for WCAG AA text?
WCAG 2.2 AA requires at least 4.5:1 contrast for normal body text and 3:1 for large text (18pt regular or 14pt bold) and UI components.
Can I convert back from RGB to HEX?
Yes, use the companion RGB to HEX converter linked below to dial channels with sliders and copy HEX.

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