Deep Dives · · 9 min read

Treemaps Explained: The Fastest Way to See Disk Usage

A disk usage treemap turns your whole drive into proportional rectangles so big folders jump out. Here's how squarified treemaps work and why they beat lists.

Ask someone to find the biggest folder on a full drive with a plain file list and they’ll spend twenty minutes expanding directories and mentally adding up numbers. Show them a disk usage treemap and they’ll point at the biggest rectangle in two seconds. That’s the whole appeal: a treemap converts abstract byte counts into physical area, so the largest consumers of your disk are, quite literally, the largest shapes on screen. This deep dive explains how treemaps work under the hood — including the “squarified” layout that makes them readable — and why they’re the fastest way to understand where your space went.

What a treemap is

A treemap is a way of visualizing hierarchical data — data shaped like a tree, where things contain other things. Your filesystem is exactly that: a drive contains folders, which contain subfolders, which contain files. A treemap takes that hierarchy and draws it as a set of nested rectangles.

The core idea is simple and powerful: the area of each rectangle is proportional to the value it represents — here, the number of bytes. The whole drive is one big rectangle. It’s divided into rectangles for each top-level folder, each sized by how much space that folder uses. Each of those is subdivided for its subfolders, and so on. A folder using half your disk takes up half the picture. A tiny folder is a sliver you can barely see. There’s no reading, no sorting, no arithmetic — proportion does the work.

The technique was invented by Ben Shneiderman at the University of Maryland in the early 1990s, originally to visualize what was filling up a shared hard drive. Disk usage has been treemaps’ killer app ever since.

How the rectangles get laid out

The interesting engineering question is: given a folder that takes up a rectangle, and a list of children with different sizes, how do you carve up that rectangle? Several algorithms exist, and the choice dramatically affects readability.

Slice-and-dice (the naive way)

The original approach simply slices the rectangle into parallel strips — all vertical, then all horizontal one level down, alternating by depth. It’s easy to compute and it preserves order, but it produces terrible shapes: long, thin slivers that are almost impossible to compare by eye or to click accurately. A file that’s 2% of a folder becomes a hair-thin line.

Squarified treemaps (the modern default)

In 1999, researchers at TU Eindhoven (Bruls, Huizing, and van Wijk) introduced the squarified treemap, which is what almost every good tool uses today. Its goal is to keep every rectangle as close to a square as possible, because squares are the easiest shape to compare in area and to click.

The algorithm is greedy. Walk the children from largest to smallest, and keep adding them to the current row as long as doing so improves the worst aspect ratio in that row. The moment adding the next item would make the squarest-possible rectangles worse, close the row, lay it out, and start a new row in the remaining space. Repeat until everything is placed.

Here’s the idea in pseudocode:

squarify(children, row, remaining_rectangle):
    sort children by size, descending
    for each child:
        if adding child to `row` keeps the worst
           aspect ratio of `row` no worse than before:
            add child to row
        else:
            lay out `row` across the short side of remaining_rectangle
            shrink remaining_rectangle by what row consumed
            start a new row with child
    lay out the final row

The payoff: rectangles stay compact and comparable, big things look big, and you can actually click the small ones. The trade-off is that squarified layouts don’t preserve the original order of items — but for “find what’s eating my disk,” order doesn’t matter; size does.

Why a treemap beats a list for spotting big folders

A descending size list is precise and sortable — it’s the right tool for reading exact numbers and acting on specific paths. But for the first question — “where did it all go?” — a treemap wins, for a few concrete reasons:

QuestionSize listTreemap
What’s the single biggest thing?Read the top rowIt’s the biggest rectangle — instant
How do two folders compare in size?Compare two numbersCompare two areas at a glance
Where is space concentrated?Scroll and tallyThe dense clusters are obvious
Is one folder full of many small files?Not visibleShows as a finely-subdivided block
Spot an anomaly you weren’t looking forEasy to missThe odd big block draws your eye

The last row is the real superpower. A list only answers the question you asked (“sort by size, show me the top 20”). A treemap answers questions you didn’t think to ask — the surprise 40 GB block from an app you forgot about jumps out because it’s big, whether or not you were looking for it. That’s why the best workflow uses both: the treemap to discover, the list to confirm and act. For the practical, OS-by-OS version of that workflow, see Where Did My Disk Space Go? Find Large Files Fast.

Reading a treemap like a pro

Once you know what you’re looking at, a treemap becomes fast to read:

  • Biggest blocks = biggest folders. Start there, always.
  • Finely subdivided blocks = folders with lots of small files (caches, node_modules, mail stores). Even if no single file is huge, the block is.
  • One giant smooth block = a single enormous file (a VM image, an ISO, a video, a database).
  • Color usually encodes type in good tools — one color for video, another for archives, another for caches — so you can spot “all my space is video” or “all my space is caches” at a glance.
  • Drill down by clicking a block to make it the new whole-picture, with a breadcrumb to climb back. This is how you go from “that quarter of my disk is one folder” to “…and it’s this specific subfolder.”

Tools that use treemaps

Treemaps are a proven staple across platforms:

  • WinDirStat (Windows) and its faster cousin WizTree — the classic Windows treemaps.
  • GrandPerspective and Disk Inventory X (macOS) — long-standing Mac treemap tools.
  • QDirStat and Baobab / Disk Usage Analyzer (Linux) — Baobab uses a related sunburst/ring layout, a radial cousin of the treemap.
  • Declutter (macOS, Windows, Ubuntu, and Linux including Omarchy) — a modern, cross-platform take that pairs a squarified treemap with a descending size list, so you get discovery and precision in one app.

From seeing to safely reclaiming

A treemap is fantastic at showing you the problem, but a picture doesn’t clean anything. This is where Declutter goes a step beyond a pure visualizer: after the treemap and size list reveal the big blocks, its cleanup copilot classifies which of them are actually safe to reclaim — caches, build artifacts, trash, duplicates, old large downloads — and explains why. You still stay fully in control: nothing is deleted without an explicit, per-phase preview and approval, and everything you remove goes to a recoverable quarantine first, with full undo. The visualization tells you where; the safety engine makes acting on it safe.

The bottom line

A disk usage treemap is the single fastest way to understand a full drive because it turns invisible byte counts into visible area — big folders become big shapes, and the squarified layout keeps every rectangle compact enough to compare and click. Use a treemap to discover where your space went, a descending size list to confirm the exact paths, and a safety-first tool to reclaim it. Once you’ve read your storage as a treemap a couple of times, going back to expanding folders one by one feels like doing arithmetic in the dark.


Want to see your disk as a treemap and clean it safely? Try Declutter — a squarified treemap, a size list, and quarantine-first cleanup with full undo, in one app. Subscribe to our newsletter for more deep dives on storage and visualization.