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.
Free tool
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
01 / HEX and RGB
Hex is red, green and blue written in base 16: #7c52ff is 124, 82, 255. Two digits each, 00 to ff.
02 / OKLCH
Lightness, chroma and hue in a space that matches how we see, so changing the lightness keeps the hue steady.
03 / Code
Values for Swift, Android (0xAARRGGBB) and Flutter, and 0 to 1 floats for shaders and design tools.
Guide
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.
7c52ff works too.#7C52FF.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.
| Pair | Channel | Sum | Value |
|---|---|---|---|
| 7c | Red | 7 x 16 + 12 | 124 |
| 52 | Green | 5 x 16 + 2 | 82 |
| ff | Blue | 15 x 16 + 15 | 255 |
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.
#f80 is shorthand: each digit is doubled, so it means #ff8800, or rgb(255, 136, 0).#f808 means #ff880088.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 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.
| Format | Where it fits | For #7c52ff |
|---|---|---|
| HEX | CSS, design tools, brand guides | #7c52ff |
| RGB | CSS, and apps that ask for three numbers | rgb(124, 82, 255) |
| HSL | Making lighter and darker shades by hand | hsl(255 100% 66.1%) |
| OKLCH | Modern CSS colour scales with even lightness | Shown in the list |
| 0 to 1 | Shaders, 3D apps and some design tools | 0.486, 0.322, 1 |
| Android | Kotlin and Java, alpha first | 0xff7c52ff |
| CMYK | A rough guide for print | cmyk(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.
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.
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
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.
The last two digits are the alpha (opacity): #7c52ff80 is about 50 percent see-through. The converter shows it as rgba() too.
No converter can be without your printer's profile. This is the plain formula; ask the print shop for their conversion for critical colours.
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.
Yes. Paste them one per line under Convert a list and choose the format.
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.
Yes, for colour they hold the same information. Hex writes the red, green and blue numbers in base 16 in one short 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.
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.
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.
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.