Convert any hex color code to RGB, RGBA, and HSL instantly with a live preview. This free online hex to RGB converter supports 3-digit shorthand (#F53), standard 6-digit (#FF5733), and 8-digit hex codes with alpha transparency (#FF573380). Use the color picker or RGB sliders to find the perfect color for your CSS, Tailwind, or design system. All conversions happen client-side in your browser.
#FF5733 is split into three pairs: FF (red), 57 (green), 33 (blue). Convert each pair from hexadecimal to decimal: FF = 255, 57 = 87, 33 = 51. So #FF5733 equals rgb(255, 87, 51). For 3-digit shorthand like #F53, double each digit first: F→FF, 5→55, 3→33, giving #FF5533.
#RRGGBB). RGB defines colors as red, green, blue values from 0–255. HSL uses hue (0–360°), saturation (0–100%), and lightness (0–100%). All three can represent the same colors — they're different notation systems. HSL is often more intuitive for designers because you can independently adjust brightness and saturation without affecting hue.
#RRGGBBAA) include an alpha channel. For example, #FF573380 has ~50% opacity (80 in hex = 128 in decimal ≈ 50.2%). CSS also supports 4-digit shorthand (#RGBA). All modern browsers (Chrome 62+, Firefox 49+, Safari 10+) fully support 8-digit hex colors in CSS.
#F53 expands to #FF5533. This shorthand can represent 4,096 colors (16³), while 6-digit hex covers the full 16.7 million color range (16⁶). Use 3-digit shorthand only when each RGB pair has matching digits — it keeps CSS more concise.
rgba(). Developers implementing designs need to convert between formats to match design specs exactly. Tailwind CSS configuration also uses hex codes that may need RGB equivalents for custom utility classes.
parseInt with base 16: const r = parseInt(hex.slice(1,3), 16); const g = parseInt(hex.slice(3,5), 16); const b = parseInt(hex.slice(5,7), 16);. For 3-digit hex, expand each character first. A complete implementation should also handle the 8-digit #RRGGBBAA format by parsing the last two characters as the alpha channel (0–255, divided by 255 for a 0–1 range).