The Google Colaboratory (“Colab”) is a notebook (like a Jupyter Notebook) where you can run Python code in your Google Drive.

You can write text, write code, run that code, and see the output – all in line in the same notebook.

Benefits of Google Colab

Sharing notebooks is as easy as sharing any Google document. You can also get the app and run the code from your phone.

You can use the powerful and popular Python language in your Google Drive, and the set-up will take less than five minutes.

Because Python runs on a server (and not in your local browser or on your local computer) you can easily use it to interact with an online database and analyze data in situations where you need to keep the code private.

How to Add Colab to Your Google Drive

  1. On your computer, in your Google Drive, click the “+ new” button.

2.  Click “more”, then click “connect more apps” at the bottom of that new menu.


3.  In the Google Workspace Marketplace, type “colab” into the search box.


4.  Click to add Google Colaboratory.


5.  Now you have Colab in your list of available apps.


How to Use Google Colab

Now when you click the “+new” button and click “more” (at the bottom of that first list) you will see “Google Colaboratory” on the next list.

Click that to open a new Colab notebook. Give your notebook a name, like you would with any Google document or spreadsheet. This notebook is in dark mode:


Type a simple command as a test. To run the code in any cell, you can click the run button on the left side of the code cell (looks like a “play” button with a triangle in a circle) or you can click [shift] + [enter]. The output will appear right below the code cell.


You can import many popular libraries without having to install them first.


If you import a library or define a function in one cell, that will still be available in other cells for at least a few minutes. The runtime will disconnect if you go 30 minutes without running a cell or if you have the notebook open for 12 hours.  

Explore Colab

If you were following along and you now have Google Colaboratory installed, you are ready to build your own projects.

If you click on the “< >” symbol on the bottom-left side of the notebook, you will find code snippets that you can use. Google also has many resources for you, some of which are at (just close out of the pop-up window that appears).

At freeCodeCamp, we are building a curriculum to show you how to use Python to solve math problems. You now have the tools at your fingertips. Happy coding!