Hex Colors and RGB Conversion Explained
Read six- and three-digit opaque hex colors as red, green, and blue channel values, with an exact worked conversion.
Published: September 22, 2026
Open Hex to RGB Converter
Quick answer
In short
- Six digits: #RRGGBB consists of one hexadecimal byte for each red, green, and blue channel.convert a color
- Three digits: #RGB expands by duplicating each digit: #abc becomes #AABBCC.
How hexadecimal colors map to channels
Hexadecimal is base 16: its digits are 0–9 and A–F. In CSS opaque #RRGGBB notation, the first pair represents red, the second green, and the third blue. Each pair ranges from 00 (0) to FF (255). Letter case does not change the value.
For #F59E0B, red is F5 = 15 × 16 + 5 = 245; green is 9E = 9 × 16 + 14 = 158; blue is 0B = 0 × 16 + 11 = 11. The result is rgb(245, 158, 11). Calzivo also shows rgba(245, 158, 11, 1), whose alpha value 1 means fully opaque, and normalized #F59E0B.
Three-digit shorthand
CSS shorthand #RGB duplicates each hexadecimal digit: #abc expands to #AABBCC. Thus AA = 170, BB = 187, and CC = 204. It does not append zeroes or interpret the three digits as decimal numbers.
CSS syntax and Calzivo input convenience
CSS hexadecimal color notation includes the leading #. The Hex to RGB Converter additionally permits those same three or six ASCII hex digits without # as an input convenience; that bare form is not itself CSS hex-color syntax. Calzivo accepts at most one leading # and does not trim whitespace. Output is normalized to uppercase hexadecimal.
Opaque-only scope
CSS Color Level 4 also defines hex forms with alpha, but this tool intentionally accepts only three or six digits. It rejects four- and eight-digit alpha notation, invalid lengths, prefixes such as 0x, and non-hex characters. It does not convert to HSL, HSV, or CMYK and does not assess contrast, accessibility, or palette suitability.
Reference check
Sources and references
These references provide background context for the topic. They do not replace professional advice or official documents.
Split six hex digits into three base-16 pairs, or duplicate each shorthand digit first. Calzivo converts opaque RGB notation only; omitting # is a tool convenience, not CSS syntax.
Use the tool instead
Use the matching calculator when you want to plug in your own numbers and get a result faster.
Open ConverterRelated Tools
Related Guides
More guides coming soon!
