Black Friday: 50% off every paid plan with code BF50. Ends 5 December.

See prices

Free tool

Hex to RGB, and every other format.

Type or paste a colour in any form, like #7c52ff, rgb(124, 82, 255), hsl(), oklch(), a CSS name or CMYK, and see it in every format at once: HEX, RGB, HSL, HSV, HWB, OKLCH and CMYK, plus 0 to 1 values and ready code for Swift, Android and Flutter. Click to copy. The side shows the red, green and blue values, text contrast against white and black, the nearest CSS name, tints and shades, and matching colours. Got a whole palette? Paste the list and convert it in one go.

Need a custom tool, app or website? Contact us 

    Convert a list

    Reads hex (3, 4, 6 or 8 digits, with or without #), rgb(), hsl(), hwb(), lab(), lch(), oklch(), CSS names like rebeccapurple, three numbers like 124 82 255, and cmyk(51, 68, 0, 0).

    CMYK here is the plain formula. A print shop converts with its own colour profile, so printed colours can differ.

    Colours are converted in your browser. Nothing is uploaded.

    How it converts

    One colour, many spellings.

    01 / HEX and RGB

    The same numbers

    Hex is red, green and blue written in base 16: #7c52ff is 124, 82, 255. Two digits each, 00 to ff.

    02 / OKLCH

    For modern CSS

    Lightness, chroma and hue in a space that matches how we see, so changing the lightness keeps the hue steady.

    03 / Code

    Ready to paste

    Values for Swift, Android (0xAARRGGBB) and Flutter, and 0 to 1 floats for shaders and design tools.

    Guide

    How to convert hex to RGB, by hand or in one paste.

    Hex to RGB conversion turns a colour code like #7c52ff into the three numbers a screen uses, red, green and blue, each from 0 to 255. The two are the same colour written two ways: hex uses base 16, RGB uses ordinary numbers. This converter reads a colour in almost any form and shows it at once as HEX, RGB, HSL, HSV, HWB, OKLCH, CMYK, 0 to 1 values and code for Swift, Android and Flutter.

    How to use the hex to RGB converter

    1. Type or paste a colour into the Colour field. The # is optional, so 7c52ff works too.
    2. Or click the swatch to pick a colour by eye.
    3. Read the list below. Every format updates as you type.
    4. Click Copy next to the format you need.
    5. Tick Capital letters in hex if your code style uses #7C52FF.
    6. Look at the side for the Red, Green and Blue values on their own, the text contrast, the nearest CSS name, and rows of tints, shades and matching colours. Click any swatch there to switch to that colour. The colours you used last are kept under Recent, and the page opens on your last colour next time.
    7. For a palette, paste colours one per line under Convert a list, choose the format in the As menu, and click Copy all.

    Converting hex to RGB by hand

    Each pair of hex digits is one channel. The digits run 0 to 9, then a to f for 10 to 15. Multiply the first digit by 16 and add the second.

    PairChannelSumValue
    7cRed7 x 16 + 12124
    52Green5 x 16 + 282
    ffBlue15 x 16 + 15255

    So #7c52ff is rgb(124, 82, 255). To go back from RGB to hex, divide each number by 16. The whole number is the first digit and the remainder is the second. For 200: 200 divided by 16 is 12 with 8 left over, and 12 is c, so 200 is c8.

    Short hex and 8 digit hex

    • 3 digits. #f80 is shorthand: each digit is doubled, so it means #ff8800, or rgb(255, 136, 0).
    • 4 digits. The same idea with an alpha digit on the end: #f808 means #ff880088.
    • 8 digits. The last pair is opacity from 00 (clear) to ff (solid). 80 is 128, and 128 divided by 255 is about 0.5, so #7c52ff80 is the same purple at roughly half opacity. The converter shows this as rgba(124, 82, 255, 0.502).

    Text contrast, tints and matching colours

    Text contrast is the WCAG contrast ratio between your colour and white or black text, from 1:1 (no contrast) to 21:1 (black on white). WCAG 2 asks for at least 4.5:1 for normal text to pass level AA, 3:1 for large text, and 7:1 for level AAA (checked 18 Oct 2026). The ratio is not rounded up, so 4.499:1 does not pass. #7c52ff gives 4.66:1 with white text and 4.51:1 with black, so both just pass AA. To check two colours of your own against each other, use the color contrast checker.

    Tints mix your colour with white in steps of 20%, and shades mix it with black. The complement turns each of red, green and blue around (255 minus the value), so #3498db becomes #cb6724. The other swatches keep the saturation and lightness and turn the hue on the colour wheel: 180 degrees for the opposite hue, 120 and 240 for a triad, and 30 either way for the colours next to it.

    Which format to use where

    FormatWhere it fitsFor #7c52ff
    HEXCSS, design tools, brand guides#7c52ff
    RGBCSS, and apps that ask for three numbersrgb(124, 82, 255)
    HSLMaking lighter and darker shades by handhsl(255 100% 66.1%)
    OKLCHModern CSS colour scales with even lightnessShown in the list
    0 to 1Shaders, 3D apps and some design tools0.486, 0.322, 1
    AndroidKotlin and Java, alpha first0xff7c52ff
    CMYKA rough guide for printcmyk(51%, 68%, 0%, 0%)

    Android and Flutter put the alpha pair first, as 0xAARRGGBB, while CSS puts it last. Mixing these up is a common reason a colour comes out wrong or see-through in an app. The converter writes each one in the right order.

    Why CMYK is only a starting point

    The CMYK value is the plain formula. For #7c52ff, black is 0 because blue is already at full strength, cyan is 1 minus 124/255, about 51%, and magenta is 1 minus 82/255, about 68%. A real print job runs through the printer's colour profile, and bright screen colours like this purple often cannot be printed exactly. Ask the print shop for a proof when the colour matters.

    On a Mac

    To find the hex code of something already on your screen, open Digital Color Meter from Applications, then Utilities. Point at the colour and it shows the red, green and blue values. Choose View, then Display Values, then as Hexadecimal to see hex pairs instead, and paste them here for the other formats.

    To check whether two colours are readable together, try the color contrast checker. To grab a colour from a photo, use the image color picker.

    Questions

    Good to know.

    How do I convert hex to RGB?

    Split the six digits into three pairs and read each pair as a number from 0 to 255: #ff8000 is ff = 255, 80 = 128, 00 = 0, so rgb(255, 128, 0). Or paste it above.

    What about 8-digit hex?

    The last two digits are the alpha (opacity): #7c52ff80 is about 50 percent see-through. The converter shows it as rgba() too.

    Is the CMYK value exact for print?

    No converter can be without your printer's profile. This is the plain formula; ask the print shop for their conversion for critical colours.

    What is OKLCH?

    A newer CSS colour form: lightness, chroma and hue. It is good for making shades of a colour, because the hue stays put as the lightness changes.

    Can I convert many colours at once?

    Yes. Paste them one per line under Convert a list and choose the format.

    How do I convert RGB to hex?

    Paste the three numbers, like 124 82 255 or rgb(124, 82, 255), into the Colour field and copy the HEX line. By hand, divide each number by 16: the whole number and the remainder are the two hex digits.

    Is hex the same as RGB?

    Yes, for colour they hold the same information. Hex writes the red, green and blue numbers in base 16 in one short code.

    Does capital or small letters matter in a hex code?

    No. #7C52FF and #7c52ff are the same colour in CSS and in design apps. Pick one style and keep it the same across your project.

    Why does my converted colour look a little different in another app?

    Some apps manage colour with a display profile, so the same numbers can render slightly differently. The values here are standard sRGB, which is what CSS uses.

    Is my colour readable as text?

    Look at Text contrast at the side. A ratio of 4.5:1 or more passes WCAG AA for normal text, 3:1 for large text and 7:1 passes AAA.

    What is the closest CSS colour name?

    The side shows the nearest of the named CSS colours, measured in OKLab so the match looks close to the eye. #7c52ff is nearest to mediumslateblue, #7b68ee.

    Listed on

    Listed on JustMacAppsMotionShine on Mac App IndexMotionShine on ScrollLaunchMotionShine featured on StartupBaseFeatured on FazierFeatured on Twelve ToolsMotionShine - Featured on Smol Launch