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.

    Paid links below. As an Amazon Associate we earn from qualifying purchases.

    Library

    Colour references for your next project

    Compare the original references behind this archive. Check the contents, edition and format before choosing a book.

    Book links are Amazon Associates affiliate links. Your price is unchanged; a small commission supports the archive. As an Amazon Associate we earn from qualifying purchases.

    • A Dictionary of Color Combinations by Sanzo Wada — book cover

      Sanzo Wada

      A Dictionary of Color Combinations

      The 2010 Seigensha republication of the 1933–34 original. Japanese import.

      The printed original behind this archive: Wada's 1933–34 combinations on Seigensha's matte plates, in a Japanese binding small enough to carry, and a copy you can cite. Every plate is also free to browse here, hex values and all. Already know it? Vol. 2 is a different book of his later work.

    • A Dictionary of Color Combinations Vol. 2 by Sanzo Wada — book cover

      Sanzo Wada

      A Dictionary of Color Combinations Vol. 2

      Seigensha, 2020. Japanese import.

      Wada's 1935–36 and 1938 follow-ups: 72 plates on the Japanese seasons and 165 drawn from early-century fashion, interior, and graphic design. Not in Vol. 1. Not in this archive. The book itself is a design object — Japanese binding, matte pages, zero captions.

    Torn between the two Wada dictionaries? Vol 1 vs Vol 2, compared plate by plate →

    Book links are Amazon Associates affiliate links. Your price is unchanged; a small commission supports the archive. As an Amazon Associate we earn from qualifying purchases.

    Last updated

    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.

    Did you find what you were looking for?

    Not quite? Tap what was off: