MineSpecsLoading world…
All articles
RedstoneAug 5, 2026 8 min read

How to Build an Automatic Item Sorter

A hopper filter that never leaks: the exact 22-item template, the comparator step that drives it, and why cells drain items into the wrong chest.


Dump a full inventory into one chest, walk away, and come back to every stack filed in a labelled barrel with the leftovers sitting in an overflow chest. That is the entire payoff, and it runs on two mechanics: a hopper will only accept an item that already has somewhere to sit among its five slots, and a comparator can read exactly how full that hopper is. Get both right and the wall never leaks and never jams.

The rule that makes a filter possible

When anything tries to push an item into a hopper, the hopper walks its five slots in order and drops the item into the first slot that will take it — an empty slot, or a slot already holding the same item with room left in the stack. If no slot qualifies, the insertion simply fails and the item stays where it was.

Fill all five slots with cobblestone and that hopper now accepts cobblestone and nothing else. That is the filter. Everything else in a sorter exists to protect that state.

The problem is that hoppers do not sit still. A hopper with a container in front of it pushes one item out every 8 game ticks — 2.5 items a second — whether or not anything is coming in. Point a loaded filter hopper straight at a chest and it empties itself in under ten seconds: slot 1 first, then slot 2, then the rest. The moment the last slot goes empty, that cell will accept any item in the game.

TipEvery leak in a sorter wall traces back to one thing: a filter hopper with an empty slot. Protect the five slots and there is almost nothing else that can go wrong.

So the filter hopper is never allowed to push. You aim it sideways into a plain solid block — hoppers only transfer into containers, so a hopper aimed at stone can never push anything out. It still pulls from whatever sits directly above it, which is exactly what you want; it simply never empties itself. A second hopper underneath pulls items out of it, and that second hopper is the one redstone switches on and off. If any of that is unfamiliar, the hopper mechanics guide covers pull direction, cooldowns and locking in detail.

The numbers that go in the five slots

A comparator behind a container outputs a signal based on how full it is, measured as a fraction of every slot being full of a full stack. For a hopper that works out to:

strength = floor(14 × (sum of count ÷ max stack size across all slots) ÷ 5) + 1, or 0 if the hopper is completely empty.

For an ordinary item that stacks to 64, that collapses to floor(14 × total ÷ 320) + 1, which gives you these bands:

  • 1 to 22 items in the hopper → strength 1
  • 23 to 45 items → strength 2
  • 46 to 68 items → strength 3

So the template is 18 in the first slot and 1 in each of the other four — 22 items. That is the largest total that still reads strength 1 with all five slots occupied. The 23rd item of that type tips the comparator to 2, and that single step from 1 to 2 is the whole control signal for the cell.

Why 18 in slot 1 rather than one item in each slot? Because hoppers push and pull from the first non-empty slot, and insert into the first matching slot. All traffic through the cell therefore goes in and out of slot 1 — slots 2 to 5 are never touched in normal running. Loading slot 1 to 18 costs nothing, keeps you inside the strength-1 band, and means that if you ever break the torch, edit the wiring, or the cell gets caught out by a chunk-load hiccup, the items lost come out of a buffer instead of out of the four slots that keep the filter alive.

Items that stack to 16 — ender pearls, snowballs, eggs, signs, banners — use the same formula with a different denominator, and the maximum drops sharply: one item in each of the five slots, five total, and the sixth trips the comparator. Those cells work perfectly but carry no buffer at all, so check them occasionally.

Under-filling is what kills a cell. Never leave a slot empty and never take items back out of a filter hopper. Over-filling deserves its own warning, because it is not as harmless as it looks. Adding a few items on top of the template is fine: the cell reads a higher signal, unlocks, and calmly files the surplus into the barrel until it settles back at 22 with slot 1 still holding its buffer. But shift-click a whole stack of 64 in and the surplus spills past slot 1 into slot 2 — slots read 64, 19, 1, 1, 1 — and when the cell drains itself back down it empties slot 1 first and stops the instant the total hits 22. You are left with 0, 19, 1, 1, 1: an empty first slot, and a cell that now accepts anything. Top slot 1 up by hand in small amounts instead of dumping stacks into a live filter.

Building one cell

From the ground up, in a single column:

  1. 1.A barrel or chest.
  2. 2.The drain hopper on top of it, facing down into that container.
  3. 3.The filter hopper on top of the drain hopper, facing sideways into a solid block. Not down. This is the step people get wrong.
  4. 4.The bus hopper on top of the filter hopper, facing sideways along the wall into the next cell's bus hopper.

Then the wiring, behind the column:

  1. 1.A comparator directly behind the filter hopper, facing away from it, so it reads that hopper and no other.
  2. 2.Exactly two redstone dust in a line out of the comparator's output.
  3. 3.A solid block at the end of that line with a redstone torch on it, placed so the torch — or a block the torch powers — touches the drain hopper and nothing else.

Two dust is not arbitrary. Dust placed directly in front of a comparator takes the comparator's full output strength, and every further dust drops one. Strength 1 reaches the first dust and dies at the second. Strength 2 arrives at the second dust as strength 1, powers the block, switches the torch off, and unlocks the drain hopper for exactly one transfer. If comparator bands and torch inverters are new to you, read comparators explained and redstone basics first.

With the redstone built, the torch is lit and the drain hopper is locked, so it is safe to load the template: 18 of your item in slot 1, one each in slots 2, 3, 4 and 5. Right-click them in one slot at a time.

Why the cell holds its template

Follow one item through:

  1. 1.The filter hopper holds 22. Comparator reads 1. Torch lit. Drain hopper locked. Nothing moves.
  2. 2.A cobblestone arrives in the bus hopper above. The filter hopper pulls it down — hoppers pull from whatever container sits directly above them, regardless of which way that container faces — into slot 1. Now 23 total.
  3. 3.The comparator jumps to 2, the second dust lights, the torch goes out, and the drain hopper unlocks.
  4. 4.The drain hopper pushes whatever it is holding into the barrel and pulls one item off the top of the filter hopper. Back to 22.
  5. 5.The comparator drops to 1 again within a redstone tick or two, which is well inside the drain hopper's 8-tick cooldown, so it relocks before it can take a second item.

That is the whole loop, and it is self-correcting in both directions. It cannot drain below 22 because the lock returns, and it cannot climb above 22 for long because the lock releases.

The overflow behaviour falls out of the same design for free. When the destination barrel fills, the drain hopper backs up, the filter hopper stops being emptied and fills to five full stacks, and then it simply refuses further insertions. The bus keeps running past it. Surplus rides to the end of the wall instead of jamming the line or popping out as entities. Empty the barrel later and the cell drains itself back down to 22 on its own.

Chaining cells into a wall

  • Put a double chest at the head of the line with a hopper under it feeding the first bus hopper. That is your dump point.
  • Every cell is one block wide. Bus hoppers chain horizontally, each facing into the next.
  • The final bus hopper must feed a genuine overflow chest — ideally a double chest with a hopper under it into a second one. Never leave the bus dead-ending into a block, or unsorted items back up into your dump chest.
  • For double-chest capacity per item, build two-wide cells: two bus hoppers, two filter hoppers with identical templates, two drain hoppers, one double chest underneath.
  • For a second row, run a second bus below the first row of barrels and feed it from the first bus's overflow.
  • Throughput is the ceiling nobody plans for. Each hopper moves 2.5 items a second and the bus is serial, so a very long wall fed from one chest takes its time. Split into two independent buses rather than building a fifty-metre single line.
  • Hoppers cost server tick time whether they are working or idle. Build the cells you will actually use.

What will never sort, and why

Unstackable items break hopper filters completely. A slot holding one item with a maximum stack size of 1 is a full slot. It can never accept a second, so a filter hopper loaded with five swords accepts nothing at all, and every sword that comes down the bus rides straight to overflow. That covers tools, weapons, armour, potions, filled buckets, minecarts, boats, saddles, beds, enchanted books and shulker boxes. Empty buckets are the odd one out of that group — they stack to 16, so they sort like any other 16-stack item. For the genuinely unstackable, there is no template arrangement that fixes this — it is a property of stack size, not of your wiring. Send them to a dedicated overflow chest and sort them by hand, or park them in shulker boxes.

Items with different data are different items. A renamed, enchanted or damaged tool will not stack with a plain one, so it will not enter a filter built from plain ones. Likewise oak planks and birch planks are separate items and need separate cells.

When items land in the wrong chest

Almost always, the offending cell has an empty slot. Open the filter hoppers and count — the one with a zero in it is your culprit. The usual causes:

  • You only loaded slot 1. All five slots must be occupied. Four filled slots plus one empty slot is not a filter, it is a bin.
  • You took items back out. Pulling the template out of a filter hopper to use the cobblestone is the single most common way people break their own wall.
  • You shift-clicked a full stack into a live filter hopper. As above, the cell drains slot 1 to zero on the way back down to 22 and quietly turns into a bin.
  • The comparator is reading the wrong container. It must sit directly behind the filter hopper. Behind the drain hopper it reads a container that is nearly always empty, so the comparator outputs 0, the torch never goes out, the drain hopper never unlocks, and the cell silently sorts nothing.
  • The lock signal is touching the wrong block. If the powered block or torch touches the filter hopper, that hopper cannot pull from the bus and the cell stops working. If it touches a bus hopper, the entire bus stalls behind it.
  • Redstone bleed between neighbouring cells. Dust from one cell reaching the next cell's torch block will unlock that cell permanently, and a permanently unlocked drain hopper empties its filter hopper in seconds — after which it takes everything. Keep one block of air between wiring runs, or alternate cells to opposite sides of the wall.
  • Two cells filtering the same item. The upstream one wins and the downstream one starves. Not a leak, but it looks like one.
  • You sent items down the bus before loading the templates. Load every filter hopper first, then open the taps.

Feeding it

The sorter is worth building the moment you have something producing bulk output. An auto smelter feeding straight into the dump chest keeps ingots, glass and charcoal separated with no input from you, and a gold farm will bury a sorter wall in nuggets, swords and rotten flesh — a good stress test, since the nuggets and the flesh both stack to 64 and will pin your bus at its throughput ceiling, while the swords are unstackable and ride to overflow by design.

Before you walk away, run the check: every filter hopper has all five slots occupied, every comparator sits behind a filter hopper, every torch touches only its own drain hopper, and the last bus hopper feeds a real overflow chest. Get those four right and the wall runs untouched for years.

#redstone#storage#hoppers#automation