HEX to RGB Converter
About this tool
About HEX to RGB Converter
Paste a hex colour code and get its RGB value straight away, ready for CSS, a design tool or code that needs separate red, green and blue numbers. The converter understands every hex form: three digits like #f80, six digits like #ff8800, and the four and eight digit forms that carry transparency, which become rgba() with the alpha worked out for you. You can leave off the # too. The RGB result sits at the top of the list, with a plain comma-separated version for spreadsheets and code, and HSL, HSV, OKLCH, CMYK, the nearest CSS name and Android and SwiftUI values below it in case you need them. Use the picker or the screen eyedropper if you don't have a code yet. Conversion is exact and runs entirely in your browser.
Built and maintained by Abhi JainUpdated
How to Convert HEX to RGB
- 1
Paste the hex code
Type or paste the code, such as #5B3DF5, into Enter any colour.
- 2
Copy the RGB value
Press the copy icon next to RGB, or next to RGB values for plain numbers.
HEX to RGB Converter: questions and answers
How do you convert HEX to RGB by hand?
Split the code into pairs (RR, GG, BB) and convert each pair from hexadecimal: the first digit × 16 plus the second. #5B3DF5 → 5B = 5×16+11 = 91, 3D = 61, F5 = 245, so rgb(91, 61, 245).
What about 3-digit hex codes?
Each digit is doubled: #f80 is the same as #ff8800, which is rgb(255, 136, 0).
How do I convert 8-digit hex with transparency?
The last pair is alpha from 00 to FF. Divide it by 255 for the rgba() alpha: #5B3DF580 → rgba(91, 61, 245, 0.5).
Is HEX or RGB better in CSS?
They describe the same colours and perform the same. HEX is shorter; rgb() is easier to read and to change opacity with.
More Color Picker & Converter presets
Related tools
- Color Palette GeneratorColour harmonies, tints and shades and a 50–950 scale, exported as CSS, Tailwind, JSON or PNG.
- Color Contrast CheckerCheck WCAG 2.2 AA and AAA contrast for text and UI, and get the nearest passing colour.
- Color Extractor from ImageExtract the dominant colours from any image and copy them as HEX, RGB or CSS variables.
- CSS Gradient GeneratorLinear, radial and conic CSS gradients with a live preview.