Skip to Content

Kids Can Code! Simple and Fun Lego Coding Activities

Simple Lego Coding Activities for Kids.

Simple Lego coding activities for kids. Start your kids on the path to coding with these easy STEM activities! #coding #kids #Legos #STEM #learning #activity #toddler #preschool

My 4-year-old knows how to code.  Okay, that isn’t entirely true.  That would be awesome if he did though.  He does know that coding is telling a robot or computer what to do.  (Thank you, Blaze and the Monster Machines.)  And while that is a simplistic definition of what coding is, he isn’t wrong.  Coding is telling something what to do.  While we usually think of coding as something complicated that goes on behind the scenes with computers, it is something we can start to teach to kids in a fairly simple manner. Legos are accessible and perfect toys for this.  Let’s learn to code with legos.

Lego Coding Activities

Why Learn Coding?

Why should you start to introduce the concept of coding to your kids?  Well, a big argument is that technology doesn’t appear to be slowing its progress any time soon.  We are already an online society, and more and more parts of life are going online.  Computers are everywhere and those are run by coding.  Being at least familiar and somewhat comfortable with the ideas and terminology behind this field will make your child more open to learning more about it.  They will feel as though coding is for them.  That is key to opening up fields to all kids.

(Learn the benefits of teaching kids about coding—> 8 Reasons Kids Should Learn To Code)

Learn basic coding concepts with Legos! Easy and fun ways to encourage kids to explore coding. Toddler and up! #coding #legos #learning #activity #toddler #preschool #kids #color #pattern
Learn to Code with Legos

More than just the actual technology, coding teaches a lot of important skills!  It teaches persistence, logic, focus, organization, and patience.  Oh, and it helps with math and communication skills.  Coding is so much more than just math.  The math is important, but at the end of the day, you are trying to communicate when you program a computer.  So this really is a skill that kids can use in all aspects of life.

The great thing about using legos to introduce coding concepts is that the activities can grow with your children.  Start with the simple ideas and games to really lay the groundwork for what will come and you might be surprised with what your children can come up with!

Level One

Learn how to teach coding with Legos! Toddlers and preschoolers can learn colors and practice sorting. #coding #Legos #toddler #preschool #learning #color #sorting #activity

The most basic level of this coding is learning your components.  In other words, knowing how to sort your legos.  Lego sorting gives toddlers the chance to practice their colors.  Start with having your little one separate the bricks based on color.  As they get better at that you can add in sorting the size of the bricks.  This practices counting.  It can be a bit tough for little ones as the bricks are small, but they can do it.

After you have sorted by one trait, just color or just number, try sorting by two traits.  Color AND size.  For example, can your child make a pile of all the red 4×4 bricks and the blue 2×4 bricks? It is tougher to have to look at two distinct characteristics at the same time.

Level Two

Practice pattern recognition with Legos. Start basic coding concepts with toddlers, preschoolers, and kids. #coding #Lego #pattern #activity #STEM #learning #activity

The next level is recognizing and repeating patterns.  Coding involves a lot of pattern recognition.  In binary all information is relayed in ones and zeroes, so the computer needs to recognize the pattern and equate that to the meaning.  So after sorting is done we need to work on patterns.

Start with simple patterns, things like ABAB.  Build the pattern and ask your child to say it to you.  Then ask if they can recreate it.  This is recognizing the pattern.  Let them try a few.  After your child can copy the pattern ask if they can predict what is next and repeat the pattern.  This is a little harder than just copying.  It requires them to think through what has happened and what should happen next.

As your child gets better at this move onto more complicated patterns.  Things like ABCABC or ABACABAC.  Whatever you can come up with is perfect.  This is also a perfect time for older and younger kids to work together.  Have older siblings make patterns for their younger siblings to copy and predict what comes next.  This is a great way to get kids at different levels working together!

Level Three

Now that patterns are understood it is time to assign meaning to our patterns.  An easy way to start this is to create a pattern that represents a letter in the alphabet.  For example, a single red brick represents the letter A. Two represent the letter B, three C and so on.  Using this code you can write out words and sentences using Legos!

The one downfall to this sort of simple code is that it gets really long.  Plus when computers read code they need to know when a letter ends, meaning how do you know the information being relayed is one letter represented by a string of ten bricks or is it two letters of three bricks and seven bricks?  One option to fix this is to create a break code.  So if all our letters are represented by a series of red bricks we can insert a blue brick to show that letter is complete.

Another option that compresses a code a little more efficiently is to create patterns that all have the same parameters.  For example, we can represent each letter of the alphabet using only 5 bricks with 2 different colors.  This way a computer would know that each set of five bricks represents a letter without needing an additional divider.

Basic coding concepts with legos. Teach your kids coding basics easily. Fun STEM activities! #coding #lego #learning #kids #preschool #STEM #science

I have put together a sample code for your kids to try.  Have your children try to copy this code and make different letters.  Can they make the alphabet?  Can they spell out words?  As your child gets better you can spell out messages to each other!

Level Four

Once your child has mastered the code given, it is time to really step it up. Challenge your child to create their own code.  The sky is the limit here.  How can they use the Lego bricks to represent the letters of the alphabet?  They can use a blank pattern sheet to color in and make their own pattern, but this is just one way to do it.  Can they use six bricks to represent each letter?  Can they create codes for whole words?

This is a fun way to explore your child’s creativity and really do some critical thinking to solve a problem.  I used a blank letter code form and let Ben color it in to try to make his own code.  (You can find a copy in my free printables section!)  Your child’s imagination is the limit!

Teach your kids coding basics with Legos! 4 levels of activities for kids of all ages, toddler and up. Color sorting, pattern recognition, and basic codes included. #coding #legos #STEM #learning #activity #toddler #preschooler #kid

What are you going to try next? Here’s some areas to check out.

STEM activities for kids
DIY slime and playdough recipes
anatomy activities for kids

Coding is for Everyone

This is just laying the groundwork for coding, there is obviously a lot more to it.  But these skills are important for kids and they can use them in daily life!  The other important aspect of this sort of activity is that it makes coding accessible to kids.  Sometimes STEM topics feel too far off, like they aren’t for us.  That is so discouraging!  Introducing ideas and terminology at a young age takes away some of the mystery behind these topics, which in turn takes away the fear to try them out.  Kids can do what we think they can do, and what we encourage them to think they can do.  And kids can code.


Want to get printable copies of the sample alphabet code and blank alphabet codes?  They are available in my free printables section!  All you need to gain access is to join the Team Cartwright mailing list.  When you sign up you will receive an email with the password that opens up all the free printables.  It also adds you to my mailing list!  Grab these worksheets and all the others to help your kids learn and have fun!


I want the Freebies! (This gives you access to the free printables and adds you to the Team Cartwright mailing list.)

* indicates required

Intuit Mailchimp

Check out these other fun learning activities

5 Simple and Fun Games to Teach Your Child Number Sense! Grab some dice and play these fun and easy games while your preschooler learns number sense. Help build math success! #number #sense #learning #activity #games #preschool #toddler #math
Simple Sound Science Activities for Kids! 4 easy ways to explore how sound waves work, all using items you have at home. #learning #activity #preschool #simple #sound #science #homeschool
Mystery Tinker Bags for Creative STEM Fun. Create opened imaginative play that encourages critical thinking and problem solving. STEM Kids | Learning Activities | Art Craft | Science Project #STEM #science #toddler #kids #preschooler #easy #DIY #science #art #craft #project
Teach your children coding with legos! These free printables will help kids learn about coding. #coding #legos #learning #activity #printable #free #kids
Learn how to make secret codes with Legos! What your kids are really learning are coding basics. Unplugged coding fun for preschoolers and kids! #Coding #CodingforKids #Legos #LegoCoding #SecretCode #SecretMessage #LearningActivity #STEM #ComputerScience #Science #Preschool
Easy and fun Lego games to build math and reading skills in your preschooler! Counting, patterns, colors, and more! #lego #legolearning #learning #learninggame #counting #colors #patterns #toddleractivities #preschoolactivities

How useful was this post?

Click on a star to rate it!

Let us improve this post!

Tell us how we can improve this post?

Ouch! Biting while nursing is no joke, and twins of course add double the challenge. Here is why babies bite and how to handle it when your breastfeeding twins bite. #twins #breastfeeding #baby #bite #biting #tips
Double Ow! What To Do When Your Breastfeeding Twins Bite
← Read Last Post
7 Big Benefits of Coloring for Kids. Learn why simple coloring is so beneficial to children's physical and emotional development. Plus grab some free coloring pages to boost number sense and coding concepts! #coloring #pages #free #learning #activity #mental #physical #development #toddler #preschooler #kid
Why Should Kids Color? 7 Big Benefits Coloring Provides for Kids
Read Next Post →

* Checkbox GDPR is required


I agree

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Tuesday 18th of August 2020

Great blog to read with some interesting ways to teach coding to kids in a fun way. Totally agreed with what you said, coding teaches lot of important skills to kids. They not improve their problem solving abilities but increase their confidence to a next level. Your blog has so nicely explained the importance of Lego in making kids learn from basic to advance level of coding concepts. Thanks for sharing this with us.


Tuesday 18th of August 2020

Thank you for your kind words!


Sunday 22nd of July 2018

I love this! Turning Lego play into a code alphabet and pattern matching. Brilliant!


Sunday 22nd of July 2018

This is so cool. We are big lego lovers here, this is such a great activity to do with them!

J. Ivy Boyter

Saturday 21st of July 2018

What a fabulous learning activity with toys moms likely already have at home! My kids love Legos :D


Friday 20th of July 2018

This is awesome and such a great idea. I want to get my toddler familiar with coding and this seems like a great place to start! Thank you for sharing

This site uses Akismet to reduce spam. Learn how your comment data is processed.