Tool to convert colors to Red Green Blue (RGB RGB) with display of values, hexadecimal code, 24-bit integer etc.
Color in Red Green Blue - dCode
Tag(s) : Physics-Chemistry
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
The RGB (Red, Green, Blue) model (also spelled RGB for Red, Green, Blue) is a color representation system based on the addition of the three primary colors of light.
Each component (R, G, B) can take a value from 0 to 255, allowing for over 16 million colors.
From the three RGB values (each component must be between 0 and 255), the integer is calculated using the formula
$$ R \times 255^2 + G \times 256^1 + B \times 256^0 \\ = R \times 65536 + G \times 256 + B $$
Computer-wise, the formula can be rewritten as: $ ( R \ll 16 ) + ( G \ll 8 ) + B $ with $ \ll $ the left-shift operator.
Example: The values are Red = 64, Green = 128, and B = 192, so the corresponding integer is $ 64 \times 65536 + 128 \times 256 + 192 = 4227264 $
— If the components are written in 8-bit binary, concatenate them in RGB order to obtain a binary integer.
Example: R = 01000000, G = 10000000, B = 11000000, RGB = 010000001000000011000000 in binary, or 4227264 in decimal.
— If the components are written in hexadecimal, combine them in RGB order.
Example: R = 0x40, G = 0x80, B = 0xC0, RGB = 0x4080c0 in hexadecimal or 4227264 in decimal
— If the components are numbers between 0 and 1, multiply them by 255 and repeat the formula above.
In computing, numbers between 0 and 255 are encoded with two hexadecimal digits. Therefore, RGB triplets are often written in the format #RRGGBB in RGB:
— The first two characters (RR) for the hexadecimal value of Red
— The next two for Green (GG)
— The last two for Blue (BB)
Example: Color #4CAF50, i.e. (0x4c = 76 for red, 0xaf = 175 for green, and 0x50 = 80 for blue)
RGB (Red, Green, Blue): additive model, used for screens.
CMYK (Cyan, Magenta, Yellow, Black): subtractive model, used for printing.
The transition from RGB to CMYK is not trivial because the color space is not identical (not all colors displayed on a screen can be printed).
dCode retains ownership of the "Color in Red Green Blue" source code. Any algorithm for the "Color in Red Green Blue" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Color in Red Green Blue" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Color in Red Green Blue" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Color in Red Green Blue" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Color in Red Green Blue on dCode.fr [online website], retrieved on 2025-05-13,