Written and maintained by CASRAI Editorial Board
Last updated
Google Colab (Colaboratory) is used to write and run code in a notebook that lives in your browser, with no software to install on your own computer. Google’s Colab FAQ describes it as “a hosted Jupyter Notebook service that requires no setup to use” and says it is “especially well suited to machine learning, data science, and education.” For researchers that translates into three jobs: exploring and analysing data, teaching or learning a method, and sharing a worked analysis with collaborators. This guide covers what those uses look like, how to get started, how to read the output, and the limits that decide when Colab is the wrong tool.
Most introductions to Colab stop at “free browser Python.” The part that matters in a research setting is what a shared Colab notebook does and does not carry with it: your code and outputs travel, but the machine, the files and the installed libraries do not. That has consequences for reproducibility and data governance, covered below.
What is Google Colab used for in research?
Colab is a place to run notebooks. A Jupyter notebook document contains “the inputs and outputs of an interactive session” together with explanatory text; it is stored internally as JSON with the .ipynb extension, and the content of each code cell is sent to the kernel associated with the notebook (Jupyter Notebook documentation). Colab hosts that same kind of notebook on Google’s side, so the practical uses are the ones notebooks are good at:
- Exploratory data analysis. Load a dataset, run a step, look at the result, adjust, and keep the text explaining why next to the code.
- Machine learning and data science work. The FAQ names these as the areas Colab is best suited to, and it offers optional accelerated runtimes (GPU and TPU) for them.
- Teaching and learning. Education is the third use named in the FAQ. Because nothing has to be installed locally, a class can start from the same notebook in a browser.
- Sharing a worked analysis. Notebooks are shared like Google Docs, so a collaborator can open the analysis you ran rather than a description of it.
It is not designed for long unattended jobs. See the limits section below before planning a multi-day computation.
How do you get access?
Colab is run by Google and is used through a Google account. For people on an institutional Google Workspace account, the FAQ states that “access to Colab for Workspace users is controlled by the Workspace on/off control,” so your institution’s administrator decides whether it is available to you. If it is switched off, that is an institutional policy question, not a technical fault.
Step by step: running an analysis in Colab
These steps use only the actions described in Google’s Colab FAQ. Menu labels in a hosted tool can change, so treat the FAQ as the reference if a label looks different.
- Open a notebook from your Google account in the Colab site. A notebook is a sequence of text cells and code cells.
- Put your setup in the notebook. The FAQ advises that notebooks include cells that install and load any custom libraries or files they need, because the virtual machine, its files and its libraries are not shared along with the notebook. Write these cells first so anyone can re-run the notebook from the top.
- Choose the hardware, only if you need it. Open Runtime, then Change Runtime Type, and set the Hardware Accelerator. Setting it to None turns acceleration off. The FAQ warns that “executing code in a GPU or TPU runtime does not automatically mean that the GPU or TPU is being utilized,” so your code or library must be written to use it.
- Run the cells in order and check each output before moving on.
- Share the notebook the way you would share a Google Doc. Before you do, read the data-handling points below, because the full contents of the notebook (text, code, output and comments) are shared.
- Reset when something goes wrong. Runtime, then Disconnect and delete runtime, resets the managed virtual machine, after which you re-run your setup cells.
Output and how to read it
Each code cell shows its output directly beneath it, and the saved notebook keeps the code, the text and those outputs together in one document. Two reading rules follow from that:
- An output belongs to the run that produced it. A cell run earlier, before you changed an input or restarted the runtime, may still show an old result. Re-run from the top before you trust or cite a figure.
- Outputs are shared with the notebook. Anything printed, plotted or commented on is visible to everyone who can open it. Clear outputs that show sensitive records before sharing.
For results that must be re-created later, record the library versions in your install cells and read the guidance in computational reproducibility. See also sharing a reproducible conda environment for the equivalent on a local machine.
Limits that decide whether Colab fits the job
Google’s FAQ is direct about what Colab does not promise:
- “Colab resources are not guaranteed and not unlimited, and usage limits sometimes fluctuate.”
- Runtimes time out if you are idle, and virtual machines have a maximum lifetime enforced by the Colab service. In the free-of-charge version of Colab, “notebooks can run for at most 12 hours, depending on availability and your usage patterns.”
- Accelerated hardware is optional and not used automatically (see step 3).
So Colab suits exploration, teaching and analyses that finish within a session. A computation that must run for days, or that must be guaranteed the same hardware every time, belongs on infrastructure you control.
Data governance for research use
Three statements in the FAQ matter for anyone handling research data:
- Drive access. “Mounting Google Drive on Colab allows any code in your notebook to access any files in your Google Drive.” Run only code you trust, and keep unrelated files out of the Drive account you connect. Users typically have to grant access again each time they connect to a new runtime.
- Sharing. Sharing a notebook shares “the full contents of your notebook (text, code, output, and comments).”
- AI features. The FAQ tells users not to include sensitive, confidential or personal information in prompts, and states that AI data is retained for up to 18 months.
If your data is covered by a data use agreement, an ethics approval or a funder policy, check what it allows before putting that data into any hosted service. This is a question for your institution’s research data or compliance office, not something a notebook tool can answer.
Troubleshooting
| Symptom | What the FAQ says to look at |
|---|---|
| Notebook stops after a period of inactivity | Runtimes time out when idle and have a maximum lifetime; in the free-of-charge version notebooks can run for at most 12 hours depending on availability and usage. |
| Code runs but is no faster on a GPU or TPU | Choosing a GPU or TPU runtime does not mean the code is using it. Check the code or library actually targets the accelerator. |
| A collaborator opens the notebook and imports fail | The virtual machine, files and libraries are not shared with the notebook. Add install and load cells for what it needs. |
| Runtime in a bad state | Use Runtime, then Disconnect and delete runtime, to reset the managed virtual machine, then re-run the setup cells. |
| Resources are unavailable or limits changed | Resources are not guaranteed and not unlimited, and usage limits sometimes fluctuate. |
| Colab is blocked on your institutional account | Access for Workspace users is controlled by the Workspace on/off control; ask your administrator. |
Alternatives
Because Colab hosts Jupyter-style notebooks, the closest alternative is running Jupyter Notebook yourself, where you control the machine, the files and the installed libraries. The main differences:
| Question | Google Colab | Jupyter Notebook on your own machine |
|---|---|---|
| Setup | A hosted service that requires no setup to use | You install and run it yourself |
| Notebook file | Notebook shared like a Google Doc | A JSON file with the .ipynb extension |
| Environment and files | Virtual machine, files and libraries are not shared with the notebook; runtime time limits apply | The environment is the one you set up, so you decide what is installed |
For a full side-by-side of the two, read Google Colab vs Jupyter Notebook. If you choose the local route, see Anaconda for Jupyter Notebook and Jupyter Notebook extensions; Jupyter itself is open-source software.
Frequently asked questions
What is Google Colab used for?
Writing and running notebook code in a browser, mainly for machine learning, data science and education, per Google’s own FAQ. Researchers use it for exploratory analysis, teaching a method, and sharing a worked analysis.
Do I need to install anything?
No. The FAQ describes Colab as a hosted Jupyter Notebook service that requires no setup. Your notebook should still include cells that install the libraries it needs.
How long can a notebook run?
In the free-of-charge version of Colab, at most 12 hours, depending on availability and your usage patterns, and runtimes time out if you are idle. Paid plans are described in the FAQ.
Is a shared notebook reproducible by itself?
Not automatically. The virtual machine, files and libraries are not shared with the notebook, so it needs its own install and load cells and should record versions.
Is it safe for confidential data?
Colab does not decide that for you. Mounting Drive exposes all your Drive files to notebook code, sharing exposes the whole notebook including output, and AI prompts should not contain sensitive information. Check your data agreement and your institution’s policy first.
Sources
- Google, Colaboratory Frequently Asked Questions, research.google.com/colaboratory/faq.html, checked 2026-10-29.
- Jupyter Notebook documentation, The Jupyter Notebook, jupyter-notebook.readthedocs.io, checked 2026-10-29.








