ForHosting KIT · Images

RGB to RGB555 packer

Pack an RGB color into a 15-bit RGB555 word: orange 255, 128, 0 becomes 32256, or 0x7E00. Each channel keeps its top five bits, the layout used by VGA high-color modes and older PC games. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Resistance (Ω)
255
G
128
B
0
You get
R5
31
G5
16
B5
0
Quantized r
248

Legacy graphics hardware stores color as a fifteen-bit RGB555 word instead of three eight-bit channels. This RGB to RGB555 packer takes red, green, and blue integers from zero through two hundred fifty-five, truncates each channel to five bits by dropping the three least-significant bits, and packs the result as red in bits fourteen through ten, green in bits nine through five, and blue in bits four through zero. The unused high bit stays zero so the packed integer always sits between zero and thirty-two thousand seven hundred sixty-seven. Designers, emulator authors, and retro-game toolchains use this mapping when a palette, framebuffer, or BIOS dump expects the historical fifteen-bit high-color layout used by VGA modes, older PC games, and many graphics APIs. The engine is fully deterministic: no network, no random seed, and no wall clock.

What RGB555 packing means and how the fifteen-bit word is built

Eight-bit sRGB, the model CSS and modern paint tools use, gives each of red, green, and blue two hundred fifty-six distinct levels. Fifteen-bit high color, often called RGB555, keeps only thirty-two levels per channel. The historical conversion is truncation, not perceptual rounding: shift each eight-bit channel right by three bits, which is the same as integer-dividing by eight and discarding the remainder.

Pure red two hundred fifty-five becomes thirty-one, mid grey one hundred twenty-eight becomes sixteen, and any value from zero through seven collapses to zero. Those three five-bit fields are then packed into one unsigned integer with red in bits fourteen through ten, green in bits nine through five, and blue in bits four through zero. Bit fifteen stays unused and is always written as zero, so the packed word never exceeds thirty-two thousand seven hundred sixty-seven, which is hexadecimal seven F F F.

This is the RGB555 layout documented by Windows 15-bit color, VGA high-color modes, and many PC game engines—not the BGR555 swap some handheld consoles use, where blue occupies the high five data bits.

Input contract, truncation rules, and validation that never clamps

Outer whitespace on string channels is trimmed. A value is legal only when it is a finite whole number from zero through two hundred fifty-five inclusive. There is no silent clamp and no nearest-level rounding: seven right-shifted three bits is zero, eight becomes one, and two hundred fifty-five becomes thirty-one.

That truncate-only rule matches the hardware path used by VGA high-color DACs and by countless asset converters that drop the three least-significant bits before writing a fifteen-bit framebuffer. After validation the engine packs rgb555 as red five shifted left ten bits, bitwise-or green five shifted left five bits, bitwise-or blue five. Orange two hundred fifty-five, one hundred twenty-eight, zero therefore becomes thirty-one, sixteen, zero and packs to thirty-two thousand two hundred fifty-six, written 0x7E00.

White two hundred fifty-five on every channel packs to the maximum thirty-two thousand seven hundred sixty-seven. Black packs to zero.

Where an RGB to RGB555 packer earns its keep, and what it costs

ROM hackers and asset pipelines use it to turn modern eight-bit mockups into the coarse thirty-two-level-per-channel look of 15-bit high color without standing up a full graphics library. Computer-science courses use it as a clean bit-shift exercise: students can check that two hundred fifty-five right-shifted three bits is thirty-one and that the packed word for white is 0x7FFF. Front-end developers who still ship fallbacks for historical formats, or who document how a canvas export will look after five-bit quantization, can call the same contract from a script.

Pair the free in-browser RGB to RGB555 packer with hex or HSL converters when the next step is a stylesheet, and with the 24-bit RGB integer packer when you need eight bits per channel instead of five. On this page the work runs entirely on your device.

VGA high-color palettes and older PC engines

Convert eight-bit mockup swatches into the 15-bit RGB555 words a VGA high-color mode or a classic PC engine stored in video memory.

Teaching bit shifts and five-bit quantization

Let students check that each channel is truncated with a right shift of three and packed as red in bits 14–10 without writing the shifts by hand.

How do I pack 8-bit RGB into an RGB555 value?

The response rgb555 is the packed 15-bit word ((r>>3)<<10) | ((g>>3)<<5) | (b>>3), also given as hex and a 15-bit binary string.

How is each channel truncated to five bits?

The engine drops the three least-significant bits with a right shift of three (integer divide by eight). There is no rounding: 7 becomes 0, 8 becomes 1, and 255 becomes 31.

What is the range of the packed RGB555 integer?

Zero through 32767 (0x0000 through 0x7FFF). Bit 15 is unused and stays zero. Pure white packs to 32767; pure black packs to 0.

What happens if a channel is outside 0–255?

Channels are never clamped or wrapped, and failed validation is not charged.

Is the RGB to RGB555 packer free?

The browser tool runs free on your device.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/color/rgb-rgb555

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/color/rgb-rgb555 \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"r":255,"g":128,"b":0}'
{
  "r": 255,
  "g": 128,
  "b": 0
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "color.rgb_rgb555",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

min_channel0
max_channel255
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Channels outside the legal eight-bit range fail with invalid_input instead of wrapping or clamping in silence. Run it free in the browser for palette work and homework checks, or call the API at $0.002 per successful item when a build pipeline needs the same contract.

What RGB555 packing means and how the fifteen-bit word is built

The response echoes the original r, g, and b, exposes the five-bit fields as r5, g5, and b5, reconstructs the quantized eight-bit look as quantized_r, quantized_g, and quantized_b by shifting the five-bit values left three places, and publishes the packed integer as rgb555 together with a 0x hex form, four uppercase hex digits, a fifteen-character binary string, a css_rgb echo of the input, a method tag rgb_to_rgb555, the formula string, bits_per_channel equal to five, and max equal to thirty-two thousand seven hundred sixty-seven. Identical inputs always produce identical JSON because the path is pure arithmetic.

Input contract, truncation rules, and validation that never clamps

POST a JSON body with three required integers: r for red, g for green, and b for blue. Each field may arrive as a JSON number or as a digit string; aliases red and capital R, green and capital G, and blue and capital B are accepted so spreadsheets and typed forms can reuse the same contract. Missing fields, empty strings, non-numeric text, Infinity, NaN, fractional numbers such as one hundred twenty-eight point five, negatives, and any channel of two hundred fifty-six or more fail with invalid_input that names the field and states that it must stay inside zero through two hundred fifty-five. Those failures are not billed.

Where an RGB to RGB555 packer earns its keep, and what it costs

Through the API each successful pack costs $0.002; validation failures do not consume balance, and nothing is stored after the response returns.

Emulator fixtures and sprite converters

Pack palette entries and framebuffer pixels into deterministic RGB555 integers so emulator tests and asset converters can assert binary dumps.

Read the full KIT documentation →