AbraCalc

RGB to Integer Converter

Pack RGB color values into a single 24-bit integer (used in many graphics APIs and game engines).

Embed this tool on your site

How to use this tool

  1. Enter red, green, and blue values (0–255 each).
  2. The tool computes the 24-bit packed integer and its hex string.
  3. Use the decimal integer in APIs that accept packed 0xRRGGBB values.

Pack R, G, B values into a single integer: color = (R << 16) | (G << 8) | B. Common in game engines, OpenGL, and low-level graphics APIs.

Frequently asked questions

How is an RGB color packed into an integer?
Red occupies bits 16–23, green bits 8–15, and blue bits 0–7. The formula is: (R << 16) | (G << 8) | B.
What range can the integer be?
0 (black) to 16,777,215 (white, 0xFFFFFF) for 24-bit RGB.

References & sources