Tools / Color Converter / HEX → RGB

HEX to RGB Converter.

A hex color is just three bytes written in base-16: two digits for red, two for green, two for blue. Converting HEX to RGB means splitting the string into those three pairs and reading each pair as a 0-255 decimal number — nothing is lost, the two notations describe exactly the same sRGB color.

RGB
All formats

    The HEX → RGB formula

    R = parseInt(hex[0:2], 16) · G = parseInt(hex[2:4], 16) · B = parseInt(hex[4:6], 16). A 3-digit shorthand like #1af expands by doubling each digit (#11aaff).

    Worked example

    Convert #1B2A4E:

    1. Strip the # → 1B2A4E
    2. Red: 1B (hex) = 1×16 + 11 = 27
    3. Green: 2A (hex) = 2×16 + 10 = 42
    4. Blue: 4E (hex) = 4×16 + 14 = 78
    5. Result: rgb(27, 42, 78)

    JavaScript

    const hex = "#1B2A4E".replace("#","");
    const r = parseInt(hex.slice(0,2),16); // 27
    const g = parseInt(hex.slice(2,4),16); // 42
    const b = parseInt(hex.slice(4,6),16); // 78

    FAQ

    Does hex include opacity?

    8-digit hex (#RRGGBBAA) adds an alpha byte. The first 6 digits are the same RGB; the last two are alpha 0-255 (FF = fully opaque).

    Is #abc the same as #aabbcc?

    Yes. 3-digit hex is shorthand — each digit is doubled, so #abc expands to #aabbcc.

    Looking for a combination we don’t have yet?

    Tell us the colour, mood, or palette you were after — it shapes which editorial combinations we add next.