Skip to the tool

Hex to RGB Color Converter

Convert hex color codes to RGB, HSL, and CSS values with a live preview and WCAG contrast ratio.

RGB
28, 31, 33
HSL
204°, 8%, 12%
CSS
rgb(28, 31, 33)
Contrast vs #1c1f21
1.00:1

A hex color code is a six-digit hexadecimal number where each pair of digits represents red, green, and blue intensity from 00 to FF. It is the standard way to specify colors on the web.

HSL (Hue, Saturation, Lightness) describes the same color in a way that is easier to reason about when adjusting a design—rotate the hue wheel, darken the lightness, or desaturate toward gray.

HSL is often easier to tweak than RGB because you can rotate the hue or darken the lightness independently. This tool shows both so you can pick whichever fits your workflow.

Common uses

Frequently asked questions

What is the difference between hex and rgb()?
They describe the same color. Hex is a compact notation, while rgb() is explicit decimal values. Most tools accept both; this converter shows you the equivalent forms.
What is a good contrast ratio for text?
WCAG AA requires 4.5:1 for normal text and 3:1 for large text (18pt+). AAA requires 7:1. The converter computes the ratio against the body text color automatically.
Can I convert shorthand hex like #fff?
Yes. Three-digit hex is expanded to six digits (#fff becomes #ffffff) before conversion.

Related tools