Color Integer Digits
Convert color integer values to RGB, HEX, and HSL digits instantly. Decode and encode 24-bit and 32-bit color integers with live preview.
About
Graphics engines, game frameworks, and low-level APIs frequently pack color channels into a single integer. A 24-bit RGB color stores red in bits 16-23, green in bits 8-15, and blue in bits 0-7, yielding a decimal range of 0 to 16777215. Misreading the byte order or confusing signed with unsigned representation produces wrong colors and hours of debugging. This tool performs bitwise decomposition on the input integer, extracting each channel via R = (n >> 16) & 0xFF, and reconstructs all standard notations. It also handles 32-bit ARGB integers (range 0 - 4294967295) where the alpha channel occupies bits 24-31.
Limitation: this tool assumes unsigned big-endian ARGB byte order, which is the convention in Android (Color.argb), Java AWT, and most CSS integer representations. Some platforms (e.g., DirectX) use ABGR order. Verify your platform's byte layout before relying on the output. Negative integers are interpreted as their unsigned 32-bit equivalent via zero-fill right shift.
Formulas
A 24-bit color integer encodes three 8-bit channels into a single decimal number. Extraction uses bitwise right-shift and masking:
For 32-bit ARGB integers, the alpha channel occupies the highest byte:
Reconstruction from components back to a single integer:
HSL conversion uses the standard cylindrical mapping. Lightness L = max + min2 where max and min are the largest and smallest of the normalized channel values. Saturation S depends on whether L ≤ 0.5. Hue H is derived from the channel deltas mapped to a 0 - 360° wheel.
Where: n = color integer, R = red channel (0 - 255), G = green channel, B = blue channel, A = alpha channel, 0xFF = 255 bitmask, >> = arithmetic right shift, >>> = unsigned (zero-fill) right shift.
Reference Data
| Color Name | Integer (Dec) | HEX | R | G | B | CSS |
|---|---|---|---|---|---|---|
| Black | 0 | #000000 | 0 | 0 | 0 | rgb(0,0,0) |
| White | 16777215 | #FFFFFF | 255 | 255 | 255 | rgb(255,255,255) |
| Red | 16711680 | #FF0000 | 255 | 0 | 0 | rgb(255,0,0) |
| Green | 65280 | #00FF00 | 0 | 255 | 0 | rgb(0,255,0) |
| Blue | 255 | #0000FF | 0 | 0 | 255 | rgb(0,0,255) |
| Yellow | 16776960 | #FFFF00 | 255 | 255 | 0 | rgb(255,255,0) |
| Cyan | 65535 | #00FFFF | 0 | 255 | 255 | rgb(0,255,255) |
| Magenta | 16711935 | #FF00FF | 255 | 0 | 255 | rgb(255,0,255) |
| Coral | 16744272 | #FF7F50 | 255 | 127 | 80 | rgb(255,127,80) |
| Teal | 32896 | #008080 | 0 | 128 | 128 | rgb(0,128,128) |
| Gold | 16766720 | #FFD700 | 255 | 215 | 0 | rgb(255,215,0) |
| Navy | 128 | #000080 | 0 | 0 | 128 | rgb(0,0,128) |
| Olive | 8421376 | #808000 | 128 | 128 | 0 | rgb(128,128,0) |
| Silver | 12632256 | #C0C0C0 | 192 | 192 | 192 | rgb(192,192,192) |
| Maroon | 8388608 | #800000 | 128 | 0 | 0 | rgb(128,0,0) |
| Purple | 8388736 | #800080 | 128 | 0 | 128 | rgb(128,0,128) |
| Indigo | 4915330 | #4B0082 | 75 | 0 | 130 | rgb(75,0,130) |
| Tomato | 16737095 | #FF6347 | 255 | 99 | 71 | rgb(255,99,71) |
| Slate Gray | 7372944 | #708090 | 112 | 128 | 144 | rgb(112,128,144) |
| Android Blue (ARGB) | 4282682111 | #FF4488FF | 68 | 136 | 255 | rgba(68,136,255,1) |