Convert hexadecimal color codes to RGB values with live color preview. Perfect for web design, CSS, and digital art projects.
Last updated: March 2026 | By Patchworkr Team
HEX (hexadecimal) and RGB (Red, Green, Blue) are two different ways of representing the same colors in digital design. Both methods specify colors by combining different intensities of red, green, and blue light, but they express these values in different formats.
RGB uses decimal numbers from 0 to 255 for each color channel, making it intuitive and human-readable. For example, rgb(255, 100, 50) represents maximum red, moderate green, and low blue. HEX uses base-16 (hexadecimal) notation with values from 00 to FF (0 to 255 in decimal). The same color would be #FF6432 in HEX format.
HEX codes are compact and widely used in web design, CSS, and HTML because they're shorter to write. RGB is more common in image editing software and programming where you need to manipulate individual color channels. Both formats can represent the same 16.7 million colors (256 × 256 × 256).
A HEX code consists of three pairs of hexadecimal digits:
Hexadecimal uses 16 digits (0-9, A-F) where A=10, B=11, ..., F=15:
Let's convert #FF6432 to RGB:
The 3-digit format (#RGB) is a shorthand where each digit is doubled. #F00 expands to #FF0000 (red). The 6-digit format provides more precision with 256 values per channel instead of 16. Use 3-digit for simple colors, 6-digit for exact shades.
Both are valid in CSS! HEX is more compact (#FF0000 vs rgb(255, 0, 0)) and has been traditional in web design. However, rgb() and rgba() are gaining popularity because they're more readable and rgba() supports transparency, which HEX doesn't (unless using 8-digit format #RRGGBBAA).
The # (hash/pound symbol) indicates that what follows is a hexadecimal color code. In HTML, CSS, and most programming contexts, the # is required. Without it, the browser won't recognize it as a color. Some design tools may accept HEX codes without the #.
HEX can represent all 16,777,216 colors (256³) in the standard RGB color space (sRGB). However, it can't represent colors outside this gamut, like those in wider color spaces (Display P3, Adobe RGB) or specialty colors (Pantone, CMYK for print).
Each RGB value (0-255) represents the intensity of that color channel. 0 means that color is off, 255 means it's at maximum brightness. rgb(255, 0, 0) is pure red. rgb(128, 128, 128) is medium gray because all channels are at half intensity.
Grayscale colors have equal values for all three RGB channels. #000000 (0,0,0) is black, #FFFFFF (255,255,255) is white, and #808080 (128,128,128) is medium gray. Any color where R=G=B will be a shade of gray.
RGBA adds an alpha (transparency) channel. rgb(255, 0, 0) is opaque red, while rgba(255, 0, 0, 0.5) is 50% transparent red. HEX has an 8-digit format (#RRGGBBAA) for transparency, but the 6-digit format is always fully opaque.
Use HEX for solid colors in CSS when you want concise code. Use rgb()/rgba() when you need transparency or when you're programmatically manipulating colors (easier to adjust individual channels). Many modern developers prefer rgb() for better readability.
Related Tools
Generate .dockerignore files.
Convert between number systems.
Convert binary to hexadecimal.
Convert binary to octal.
Convert decimal to hexadecimal.
Convert decimal to octal.