Hex to RGB Converter – Instant Color Code Translator
The Hex to RGB Converter instantly translates any hexadecimal color code into its corresponding red, green, and blue (RGB) channel values. Whether you're working on web design, CSS styling, or digital artwork, knowing how to convert hex to RGB is an essential skill. Simply enter your hex code and get accurate RGB values in seconds.
Enter a 3 or 6-digit hex color code, with or without the # symbol.
Your results will appear here
How to Use This Calculator
1. Type or paste your hex color code into the input field — for example, #FF5733 or simply FF5733. 2. Both 3-digit shorthand (like #F53) and 6-digit full codes (like #FF5533) are supported. 3. The converter will instantly display the individual Red, Green, and Blue values (each ranging from 0 to 255), the full RGB string ready to paste into CSS, and the normalized 0–1 values used in graphics programming and design tools.
How Hex to RGB Conversion Works
Hexadecimal (hex) color codes are a compact way to represent colors in web design and digital graphics. Each hex color is made up of three pairs of hexadecimal digits representing the red, green, and blue channels respectively.
Hex Color Code Structure
A full 6-digit hex code like #FF5733 breaks down as follows:
- FF → Red channel
- 57 → Green channel
- 33 → Blue channel
Each pair is a base-16 number ranging from 00 (0 in decimal) to FF (255 in decimal).
The Conversion Formula
To convert a hex pair to a decimal RGB value, simply parse it as a base-16 integer:
- R = parseInt('FF', 16) = 255
- G = parseInt('57', 16) = 87
- B = parseInt('33', 16) = 51
The result is written as rgb(255, 87, 51) in CSS notation.
3-Digit Shorthand Hex Codes
A 3-digit hex code like #F53 is shorthand for #FF5533. Each single digit is simply doubled: F→FF, 5→55, 3→33. This tool handles the expansion automatically.
Normalized RGB Values
In graphics programming, game engines, and tools like Unity or OpenGL, RGB values are often expressed as floats between 0.0 and 1.0. To normalize, divide each channel by 255. For example, 255 becomes 1.0, 128 becomes ~0.502, and 0 remains 0.0.