HEX to RGB Color Converter
Convert HEX color codes to RGB values instantly. Supports 3-digit and 6-digit HEX formats.
Open Color Converter →How HEX to RGB Conversion Works
HEX colors represent RGB values in hexadecimal notation. The 6-digit format
#RRGGBB splits into three 2-character pairs, each representing a channel value from 00 (0) to FF (255). For example, #FF5733 → R:255, G:87, B:51. The 3-digit shorthand #RGB expands each digit: #F53 becomes #FF5533. Conversion is simply parsing each hex pair as a base-16 integer.Using HEX and RGB in CSS
- HEX: Most compact —
color: #FF5733;. Common in design tools and color pickers. - RGB: More readable —
color: rgb(255, 87, 51);. Easier to modify programmatically. - With alpha: HEX supports 8 digits (
#FF573380), RGB uses thergba()function or slash syntax (rgb(255 87 51 / 50%)). - Modern CSS: Both are fully supported. HEX is more common in stylesheets; RGB is more common in JavaScript color manipulation.
// JavaScript - HEX to RGB
function hexToRgb(hex) {
const r = parseInt(hex.slice(1, 3), 16);
const g = parseInt(hex.slice(3, 5), 16);
const b = parseInt(hex.slice(5, 7), 16);
return { r, g, b };
}
hexToRgb('#FF5733'); // { r: 255, g: 87, b: 51 }
// CSS equivalents
color: #FF5733;
color: rgb(255, 87, 51);