Hex to RGB
Convert hexadecimal color codes to RGB values and vice versa with color preview and CSS output formats.
#000000
rgb(0, 0, 0)
rgba(0, 0, 0, 1)
hsl(0, 0%, 0%)
Common Colors
How to Use Hex to RGB
How to Use the HEX to RGB Converter
- Enter HEX code: Type a HEX color code with or without the # symbol (e.g., #3B82F6 or 3B82F6).
- Or enter RGB values: Input R, G, and B values (0-255) in the respective fields.
- View all formats: See the color converted to HEX, RGB, RGBA, HSL, and HSLA.
- Preview the color: A color swatch shows you the exact color.
- Copy any format: Click to copy the format you need.
Conversion Math
HEX to RGB: Each pair of HEX digits converts to a decimal 0-255.
Example: #3B = 3×16 + 11 = 59 (Red value)
RGB to HEX: Each decimal converts to two HEX digits.
Example: 130 = 8×16 + 2 = 82 (in HEX)
Features
- HEX to RGB conversion
- RGB to HEX conversion
- Real-time color preview
- HSL output included
- HSLA and RGBA formats
- Short HEX support (#RGB)
- Alpha channel/transparency
- Color picker integration
- Copy any format with one click
- Input validation
- Mobile-friendly design
- No registration required
About Hex to RGB
Web colors use two primary formats: hexadecimal (#FF5733) and RGB (rgb(255, 87, 51)). Designers and developers frequently need to convert between them for different contexts. Our converter handles both directions with visual color preview.
Color Format Details
- Hexadecimal: #RRGGBB where each pair is 00-FF (0-255 in decimal)
- Shorthand Hex: #RGB expands to #RRGGBB (e.g., #F53 = #FF5533)
- RGB: rgb(red, green, blue) with values 0-255
- RGBA: rgb() with alpha channel for transparency
When to Use Each
Hex codes are compact and widely used in CSS and design tools. RGB values are clearer for programmatic color manipulation—adjusting brightness means changing numeric values. RGBA adds transparency control not available in basic hex. Our converter provides all formats simultaneously.
Color Preview
Seeing the actual color prevents errors. A typo in hex code produces unexpected colors. Our visual preview confirms you're working with the intended shade before copying values into your project.