---
title: "Compression: Lossy and Lossless"
description: "Making a file smaller either by storing the same information in fewer bits, or by dropping detail people are unlikely to miss. Which of the two is safe depends on the file."
canonical: https://lightmysky.com/learn/computing/compression-lossy-and-lossless-mt_lx2U-B9CFa
source: https://lightmysky.com/learn/computing/compression-lossy-and-lossless-mt_lx2U-B9CFa.md
retrieved: 2026-09-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Compression: Lossy and Lossless

Making a file smaller either by storing the same information in fewer bits, or by dropping detail people are unlikely to miss. Which of the two is safe depends on the file.

Subject: Computing · Area: Computer Systems · Ages 15 to 16
Page: https://lightmysky.com/learn/computing/compression-lossy-and-lossless-mt_lx2U-B9CFa

## Ready when they can

- Describe a lossless method, such as recording runs of repeated values
- Explain what lossy compression throws away and why it cannot be put back
- Choose the right kind for a photo, a song and a file of code

## Lesson: Keep every bit, or drop what hides

Compression shrinks files so more fit and less travels. Lossless packing keeps every bit, so ZIP files and PNG images round-trip perfectly. Lossy packing drops fine detail for tiny files, and dropped detail never comes back.

**Example.** Run-length encoding condenses repeats by counting runs, always starting with the whites. The row 0001100000110000 becomes 3, 2, 5, 2 and 4. A row opening with red starts with 0, like 0, 15 and 1.

Lossy leans on your senses. A cat photo at half size still reads fine, since eyes forgive averaged colour. A drum beat masks nearby sound for 20 ms before and 200 ms after, so hidden audio can go. But re-saving lossy copies each edit grinds quality down, so keep masters lossless.

**Tip.** Match the kind to the file. Photos and songs survive trimming, while text, code and spreadsheets need every bit back.

**Recap.** Pack repeats to keep every bit, or trim hidden detail for tiny files, and keep lossless for files that must return whole.

## Practice

8 questions on this page, each with its working shown.

## Needs first

- [Sampling Sound into Numbers](https://lightmysky.com/learn/computing/sampling-sound-into-numbers-mt_yTA4W-yFjy)

## Opens up

- [Logic Gates and Truth Tables](https://lightmysky.com/learn/computing/logic-gates-and-truth-tables-mt_o2N0-q3A4Q)
