Return to site

Code a Meditation Breathing App

Educators & parents: You can do this Hour of Code Activity as a class or students can work on it independently. If you have any questions or need help, email

Many kids are learning from home these days. They’ve had to adapt to new structures and technologies, such as teleconferencing and Zoom, while dealing with distractions doing this all from home. All these changes can cause stress, and it can be difficult to focus on learning.

A growing body of research shows that mindfulness can help reduce stress and increase focus. Mindfulness is a mental state that focuses on the present moment, instead of worrying about the past or the future. By using techniques such as breathing and meditation, we can slow down our worried mind and calm our feelings.

Practicing mindfulness can be a challenge. Where can we begin? Technology can help! Mindfulness apps like ShineCalm and Headspace, guide users through breathing and meditation exercises, with soothing narration, nature sounds, and animations. Since the start of the pandemic, the number of downloads of these apps have more than doubled.

Today, you're going to be coding your own mindfulness app! First, you'll learn how to do a breathing exercise. Then, you'll program a visual to remind you and others how to do that exercise.

In the video below, Olivia from Project Peaceful Warriors shows us how to do 4x4 breathing. Breathing in for 4 seconds, and breathing out for 4.

To program your app, you'll need to go to Scratch:

Your final project will end up looking similar to this:

Breathe in as the shape gets bigger, and breathe out as it gets smaller. After you do 10 cycles, how do you feel?

Ok, let’s get coding! Watch the video below to see Olivia’s breathing guide, and then follow along with me to build your own mindfulness app:


Want to go beyond Hour of Code and make another Mindfulness app? Check out this tutorial on doing a guided "Happy Place" meditation and build an app to go with it. Or, if you liked Scratch and feel energized to make a fun game, watch this tutorial to make a race game.

If you had fun, check out our YouTube channel for more free coding projects like these! Go to