ImageColorPicker.com

    RGB to HEX converter

    Convert any RGB color to HEX — instantly and for free

    #4F46E5

    Paste any color value — we detect the format for you.

    R
    G
    B
    HEX result
    #4F46E5

    This color in every format

    RGB gives you three decimal channels between 0 and 255. Converting to HEX turns each channel into a two-digit hexadecimal number, so the whole color fits into one compact token that every browser, design tool and style guide understands.

    How RGB to HEX conversion works

    1. Take the red channel and divide it by 16: the quotient is the first digit, the remainder the second.
    2. Write the digits 10 to 15 as the letters A to F — 255 becomes FF.
    3. Repeat for green and blue, padding single digits with a leading zero: 5 becomes 05.
    4. Join the three pairs and put a # in front.

    Worked example

    RGB rgb(79, 70, 229)=HEX #4F46E5

    Exact, as long as the channels are whole numbers from 0 to 255. Fractional values such as rgb(79.5, 70, 229) are rounded to the nearest integer first, because HEX cannot store anything in between.

    RGB and HEX explained

    What is RGB?

    RGB describes a color as three channels of light — red, green and blue — each from 0 to 255. It mirrors how screens actually work: all three at 255 give white, all at 0 give black. RGB is the right choice whenever you need to calculate with a color, and rgba() adds transparency on top.

    Syntax:
    rgb(R, G, B)
    Range:
    0–255 per channel
    Best for:
    code, canvas, transparency with rgba()

    What is HEX?

    A HEX code is a six-digit hexadecimal number that stores the red, green and blue channel of a color behind a leading #. Each pair of digits covers one channel, from 00 (none) to FF (full), which gives the same 16.7 million colors as RGB in a much shorter notation. HEX is the default in CSS, design tools and brand guidelines.

    Syntax:
    #RRGGBB
    Range:
    00–FF per channel
    Best for:
    CSS, design handoff, brand guidelines

    RGB to HEX reference table

    The most common CSS colors, converted from RGB to HEX.

    ColorRGBHEX
    blackrgb(0, 0, 0)#000000
    whitergb(255, 255, 255)#FFFFFF
    redrgb(255, 0, 0)#FF0000
    limergb(0, 255, 0)#00FF00
    bluergb(0, 0, 255)#0000FF
    yellowrgb(255, 255, 0)#FFFF00
    orangergb(255, 165, 0)#FFA500
    tealrgb(0, 128, 128)#008080
    purplergb(128, 0, 128)#800080
    grayrgb(128, 128, 128)#808080

    Frequently asked questions