RGB565 Color Converter
Convert 24-bit RGB888 and HTML hexadecimal colors into 16-bit RGB565 values, or decode RGB565 back into displayable RGB888. View individual red, green and blue bit fields, binary representation and big-endian or little-endian bytes.
15–11 store 5 red bits, bits 10–5 store
6 green bits and bits 4–0 store 5 blue bits.
This produces 65,536 possible 16-bit color values.
—
What Is RGB565?
RGB565 is a 16-bit packed color format commonly used by embedded displays, framebuffers, microcontrollers and graphics interfaces where memory and bus bandwidth are more limited than on desktop systems.
The 16 bits are divided into 5 bits for red, 6 bits for green and 5 bits for blue. Green receives one additional bit because human vision is relatively sensitive to variations in green intensity.
RGB565 Bit Layout
15 11 10 5 4 0
+-----------------+--------------------+------------------+
| RED 5 | GREEN 6 | BLUE 5 |
+-----------------+--------------------+------------------+
Bits:
RRRRR GGGGGG BBBBBRGB888 to RGB565 Formula
An RGB888 color provides 8 bits for each channel. To store the color in RGB565, red and blue must be reduced from 8 bits to 5 bits while green is reduced from 8 bits to 6 bits.
R5 = R8 >> 3
G6 = G8 >> 2
B5 = B8 >> 3
RGB565 =
(R5 << 11)
|
(G6 << 5)
|
B5RGB565 to RGB888 Formula
To decode RGB565, first extract the three packed bit fields:
R5 = (RGB565 >> 11) & 0x1F
G6 = (RGB565 >> 5) & 0x3F
B5 = RGB565 & 0x1FThe calculator then expands the limited-width channels back to 8-bit RGB using bit replication.
R8 = (R5 << 3) | (R5 >> 2)
G8 = (G6 << 2) | (G6 >> 4)
B8 = (B5 << 3) | (B5 >> 2)RGB565 Red
RGB888:
#FF0000
R5 = 31
G6 = 0
B5 = 0
RGB565:
31 << 11
= 0xF800
Therefore pure red is normally represented as 0xF800 in RGB565.
RGB565 Green
RGB888:
#00FF00
R5 = 0
G6 = 63
B5 = 0
RGB565:
0x07E0RGB565 Blue
RGB888:
#0000FF
R5 = 0
G6 = 0
B5 = 31
RGB565:
0x001FCommon RGB565 Color Values
| Color | RGB888 | RGB565 | Binary Fields |
|---|---|---|---|
| Black | #000000 | 0x0000 | 00000 000000 00000 |
| White | #FFFFFF | 0xFFFF | 11111 111111 11111 |
| Red | #FF0000 | 0xF800 | 11111 000000 00000 |
| Green | #00FF00 | 0x07E0 | 00000 111111 00000 |
| Blue | #0000FF | 0x001F | 00000 000000 11111 |
| Yellow | #FFFF00 | 0xFFE0 | 11111 111111 00000 |
| Cyan | #00FFFF | 0x07FF | 00000 111111 11111 |
| Magenta | #FF00FF | 0xF81F | 11111 000000 11111 |
Why RGB565 Has 65,536 Colors
RGB565 contains exactly 16 bits per pixel. Sixteen binary bits provide 216 possible bit patterns.
2^16
= 65,536 possible RGB565 valuesRGB565 Color Resolution
The 5-bit red and blue fields each provide 32 discrete levels. The 6-bit green field provides 64 levels.
Red:
2^5 = 32 levels
Green:
2^6 = 64 levels
Blue:
2^5 = 32 levels
32 × 64 × 32
= 65,536 colorsWhy RGB888 and RGB565 May Not Match Exactly
Converting RGB888 to RGB565 discards some color precision because each 8-bit channel is reduced to five or six bits. Converting the value back to RGB888 therefore usually gives an approximation of the original color.
Colors whose components map exactly to the available RGB565 levels can round trip without visible numerical difference, while other values are quantized.
RGB565 Big-Endian and Little-Endian Bytes
RGB565 is a 16-bit number, but a device may transmit or store its two bytes in different orders.
RGB565:
0xF800
High byte:
F8
Low byte:
00
Big-endian:
F8 00
Little-endian:
00 F8Byte order does not change the logical RGB565 value. It changes how its bytes appear in memory or on a communication interface.
RGB565 on TFT and LCD Displays
RGB565 is widely used by embedded TFT and LCD controllers because it requires only two bytes per pixel. Compared with 24-bit RGB888, it reduces framebuffer size and transfer bandwidth by one third.
320 × 240 framebuffer
RGB565:
320 × 240 × 2
= 153,600 bytes
RGB888:
320 × 240 × 3
= 230,400 bytesRGB565 vs RGB555
RGB555 allocates five bits to every color channel and typically leaves one additional bit unused or uses it for another purpose. RGB565 instead gives green six bits and uses all 16 bits for color.
RGB565 vs RGB888
RGB888 provides eight bits per red, green and blue channel for a total of 24 bits per pixel and more than 16 million possible colors. RGB565 uses 16 bits per pixel and therefore requires less storage and bandwidth but has lower color precision.
RGB565 Color Converter FAQs
What is RGB565?
How do I convert RGB888 to RGB565?
What is red in RGB565?
What is green in RGB565?
What is blue in RGB565?
What is white in RGB565?
What is black in RGB565?
How many colors does RGB565 support?
Why is green 6 bits in RGB565?
Why do some displays require swapped RGB565 bytes?
Convert RGB888, Hex and RGB565 Colors
Encode full RGB colors into compact 16-bit RGB565 values or decode RGB565 numbers back into RGB888 while inspecting channel fields, binary bits and memory byte order.