Someone found an incredibly creative way of sorting Lego bricks using AI

A giant step for Lego aficionados everywhere.
 By 
Nicole Gallucci
 on 
Someone found an incredibly creative way of sorting Lego bricks using AI
A mess of unsorted Lego bricks. Yikes! Credit: SHUTTERSTOCK / 3D_KOT

For parents, children, and Lego aficionados everywhere, it's a good day to be alive.

Everyone loves to build with Lego bricks, but no one likes the cleanup — so using AI technology, Jacques Mattheij, a tech-savvy Lego-lover since childhood, found a way to make sorting Lego pieces fun and simple.

In a blog post, Mattheij told the tale of how he came to own two metric tons (more than 4,000 pounds) of the colorful bricks, which ultimately inspired him to build an automated Lego sorter. So with some "python code and a bunch of hardware to handle the parts," Mattheij set forth on his journey to sort and ensure the beloved mini-figs get a home of their own.

Essentially, the blocks are dumped into a hopper — a large funnel-shaped machine — fed onto a conveyor belt, passed by a camera to be scanned, and finally, pushed through a nozzle into a bin.

Mattheij quickly came across a few setbacks in the process. Aside from some Lego bricks being too large to fit under the camera at once, he found that in more than 38,000 shapes and 100 possible shades of color, the bricks occasionally become damaged or discolored, which can stall or lead to inaccurate sorting.

After weeks of toying with the AI, Mattheij made significant improvements and ended up with a prototype that he calls "a hodge-podge of re-purposed industrial gear," held together with the help of "copious quantities of crazy glue."

While it's not perfect, it's still pretty damn cool. Now if only someone could create an AI with the sole job of picking Lego bricks up off the floor so people never have to endure the one-of-a-kind pain of stepping on them ever again.

Mashable Image
Nicole Gallucci

Nicole is a Senior Editor at Mashable. She primarily covers entertainment and digital culture trends, and in her free time she can be found watching TV, sending voice notes, or going viral on Twitter for admiring knitwear. You can follow her on Twitter @nicolemichele5.

Mashable Potato

Recommended For You
A parent's guide to Lego Smart Bricks
child playing with lego smart brick on dinosaur model

The best Lego deals this week deals take up to $20 off Disney, Star Wars, and Marvel builds
a Lego recycling truck, Lilo and Stich Beach House, and Lego Star Wars Millennium Falcon builds all on a pink and coral-colored background

Lego debuts Smart Brick and Smart Play system that reacts as you play. Here's how it works.
A glowing lego brick.


The new and exclusive Lego Mini Pokémon Center is live — how to claim yours on Pokémon Day
Lego Mini Pokémon Center

Trending on Mashable
NYT Connections hints today: Clues, answers for April 3, 2026
Connections game on a smartphone

Wordle today: Answer, hints for April 3, 2026
Wordle game on a smartphone

What's new to streaming this week? (April 3, 2026)
A composite of images from film and TV streaming this week.


NYT Strands hints, answers for April 3, 2026
A game being played on a smartphone.
The biggest stories of the day delivered to your inbox.
These newsletters may contain advertising, deals, or affiliate links. By clicking Subscribe, you confirm you are 16+ and agree to our Terms of Use and Privacy Policy.
Thanks for signing up. See you at your inbox!