b2KIT

HEX to RGB Converter

Convert HEX color codes to RGB, RGBA, HSL, and HSLA values with visual color preview and copy options.

Tested tool guide Design and color tools Checked July 30, 2026

What HEX to RGB Converter does, with a checked example

HEX, RGB, and HSL are different notations for the same sRGB color. This converter accepts 3, 4, 6, or 8 hexadecimal digits, expands shorthand, and calculates copyable RGB, RGBA, HSL, and HSLA values. Eight-digit input keeps the final alpha channel instead of discarding transparency.

Worked example

A concrete input and expected output from the current implementation.

Input

#C49000

Expected output

rgb(196, 144, 0)
hsl(44, 100%, 38%)

C4, 90, and 00 are hexadecimal channel values. Converted to decimal they become red 196, green 144, and blue 0.

How the result is produced

1

Each channel occupies two hexadecimal digits

A six-digit value is read as red, green, and blue pairs from 00 through FF. Three-digit shorthand duplicates each digit, so #C90 expands to #CC9900.

2

HSL is calculated from normalized RGB

The largest and smallest RGB channels determine lightness and saturation, while their relative positions determine hue. Displayed HSL values are rounded to whole units.

Good uses

  • Translate a design token into a CSS rgb() value.
  • Inspect the alpha channel in a four- or eight-digit HEX color.
  • Compare a supplied HEX color with an HSL editing workflow.

Limits and checks

  • The conversion assumes the standard sRGB color space.
  • Rounded HSL values may not reproduce every RGB channel exactly.
  • Color notation alone does not establish accessible contrast.

Common questions

What does an eight-digit HEX value mean?

The first six digits contain RGB and the final two contain alpha. For example, FF is fully opaque and 00 is fully transparent.

Why does shorthand change to six digits?

CSS defines #RGB as an abbreviation where each digit is repeated. Expanding it makes the exact channel values visible.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools