User Rating 0.0
Total Usage 0 times
Category CSS Tools
Presets:
Is this tool helpful?

Your feedback helps us improve.

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.

color integer rgb converter color digits integer to hex color decoder argb converter css color

Formulas

A 24-bit color integer encodes three 8-bit channels into a single decimal number. Extraction uses bitwise right-shift and masking:

R = (n >> 16) & 0xFF
G = (n >> 8) & 0xFF
B = n & 0xFF

For 32-bit ARGB integers, the alpha channel occupies the highest byte:

A = (n >>> 24) & 0xFF

Reconstruction from components back to a single integer:

n = (A << 24) | (R << 16) | (G << 8) | B

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 NameInteger (Dec)HEXRGBCSS
Black0#000000000rgb(0,0,0)
White16777215#FFFFFF255255255rgb(255,255,255)
Red16711680#FF000025500rgb(255,0,0)
Green65280#00FF0002550rgb(0,255,0)
Blue255#0000FF00255rgb(0,0,255)
Yellow16776960#FFFF002552550rgb(255,255,0)
Cyan65535#00FFFF0255255rgb(0,255,255)
Magenta16711935#FF00FF2550255rgb(255,0,255)
Coral16744272#FF7F5025512780rgb(255,127,80)
Teal32896#0080800128128rgb(0,128,128)
Gold16766720#FFD7002552150rgb(255,215,0)
Navy128#00008000128rgb(0,0,128)
Olive8421376#8080001281280rgb(128,128,0)
Silver12632256#C0C0C0192192192rgb(192,192,192)
Maroon8388608#80000012800rgb(128,0,0)
Purple8388736#8000801280128rgb(128,0,128)
Indigo4915330#4B0082750130rgb(75,0,130)
Tomato16737095#FF63472559971rgb(255,99,71)
Slate Gray7372944#708090112128144rgb(112,128,144)
Android Blue (ARGB)4282682111#FF4488FF68136255rgba(68,136,255,1)

Frequently Asked Questions

Languages like Java use signed 32-bit integers. When the alpha channel's high bit is set (values ≥ 128), the integer overflows into negative territory. For example, fully opaque white (0xFFFFFFFF) is −1 in signed representation. This tool handles negative inputs by applying JavaScript's unsigned right shift (>>>) to recover the correct unsigned value before channel extraction.
A 24-bit RGB integer uses 3 bytes (bits 0-23) giving a range of 0-16777215. A 32-bit ARGB integer prepends an alpha byte in bits 24-31, extending the range to 0-4294967295. If your integer exceeds 16777215, it contains alpha data. Android's Color class, Java AWT, and many game engines use ARGB ordering. DirectX and some GPU APIs use ABGR - verify your platform's byte order.
0xFF in binary is 11111111 - eight set bits. The bitwise AND operation (n & 0xFF) zeroes out all bits except the lowest 8, extracting exactly one color channel. After shifting the integer right by 8 or 16 positions to move the target channel into the lowest byte, applying & 0xFF cleanly isolates it. Each channel therefore yields a value from 0 to 255.
Yes. Enter a hex value with or without the # prefix (e.g., FF6347 or #FF6347). The tool detects non-numeric input, parses it as base-16, and converts to the decimal integer for decomposition. Both 6-digit (RGB) and 8-digit (ARGB) hex strings are supported.
For pure black (0,0,0) saturation is undefined and reported as 0%. For pure white (255,255,255) saturation is also 0%. Hue is set to 0° by convention in both achromatic cases. For fully saturated primaries the conversion is exact. Rounding to whole degrees and percentages introduces at most ±0.5° hue and ±0.2% saturation/lightness error.
Color integers define channel values in the sRGB color space, but display hardware applies its own gamma curve, backlight intensity, and color gamut. An integer value of 16711680 (pure red #FF0000) will appear different on an sRGB monitor, a DCI-P3 phone screen, and an uncalibrated laptop. The integer is mathematically identical - the rendering pipeline differs. Use a calibrated display for critical color work.