Hex to RGB Formula: Decimal Math & Positional Notation
The mathematical Hex to RGB formula relies on base-16 positional numeral notation. In digital colorimetry, the hex color code range for each primary channel spans from 00 (decimal 0) to FF (decimal 255), representing 256 discrete levels per channel ($16 \times 16 = 256$).
Our hex to rgb mathematical conversion formula online breaks down how to read hex color code values in decimal online in three stages:
- Split Channel Pairs: Isolate the 6-digit hex string into Red ($R_1 R_2$), Green ($G_1 G_2$), and Blue ($B_1 B_2$) byte pairs.
- High-Order Multiplication: Multiply the first character's base-16 decimal value by 16 ($D_1 \times 16^1$).
- Low-Order Addition: Add the second character's value ($D_2 \times 16^0$) to obtain the channel decimal ($D_1 \times 16 + D_2$).
Red (3B): (3 × 16) + 11 = 59
Green (82): (8 × 16) + 2 = 130 | Blue (F6): (15 × 16) + 6 = 246
Result: rgb(59, 130, 246)To parse values inside data spreadsheets, analysts use a Hex to rgb mathematical conversion formula excel solution: =HEX2DEC(MID(A1,2,2)) for Red, =HEX2DEC(MID(A1,4,2)) for Green, and =HEX2DEC(MID(A1,6,2)) for Blue. When calculating Hex to RGB percentage, divide each channel by 255 (e.g. rgb(23.1%, 51%, 96.5%)). This exact hexadecimal to rgb calculation pairs directly with our reverse RGB to hex formula.