Skip to content

GitHub Codespaces: what it is, what it costs, how to use it free

What ships inside a codespace, how many real hours the free quota buys, and when a cloud environment beats your own machine.

Ramon Gomes 17 min read Level: Beginner

Also available in: Español, Français, Português

"Works on my machine" is still the most expensive sentence on a team. The new hire spends day one installing the right Node version, the database and whatever extension the linter wants. GitHub Codespaces shortens that path: the environment becomes a file in the repository and anyone can spin up an identical machine in minutes.

This guide answers what people ask before clicking the green button: what ships inside, what it really costs, how to use it without paying, and when you're better off on your own machine or your own server. The numbers were checked against GitHub's documentation on November 19, 2026.

What GitHub Codespaces Is

The official definition is short: "a codespace is a development environment that's hosted in the cloud" (GitHub Docs). Under the hood, each codespace is a Docker container running on a virtual machine that's yours alone. The repository is shallow-cloned into /workspaces and mounted inside the container (GitHub Docs, deep dive).

You get in through VS Code in the browser (it even works on a Chromebook), through desktop VS Code with the terminal and processes running in the cloud, or through the GitHub CLI (GitHub Docs). Machines range from 2 cores, 8 GB of RAM and 32 GB of disk up to 32 cores, 128 GB of RAM and 128 GB of disk. The remote environment is always Linux, on an isolated network: the firewall blocks inbound traffic from the internet and between codespaces (GitHub Docs).

Shared woodworking shop in a bright warehouse; a person seen from behind, wearing a backpack, arrives at a workbench that's already set up, with tools hanging in order and a piece of wood clamped in the vise
A codespace is the workbench that's already set up when you arrive: the same tool on the same hook, for you and for whoever joined the team yesterday.

The best-known case is GitHub's own. In 2021 it moved its main monorepoSingle repository that holds several related projects or packages, such as apps and shared libraries, with common versioning and tooling., about 13 GB, to Codespaces. Cloning dropped from 20 minutes to 90 seconds, bootstrap from about 45 minutes to 5, and with prebuilds a codespace opened in 10 seconds. A new team member gets a working environment "in less time than it takes to install Slack" (GitHub Blog, 2021). Those 10 seconds add up several optimizations, not a single leap.

What's Inside a Codespace

Layered diagram: a Linux virtual machine with 2 to 32 cores at the bottom; above it, the container image (universal or your own); then features; then devcontainer.json with extensions, ports and commands; then your dotfiles and secrets; on top, your repository in /workspaces
Each layer comes from a different place: the machine from GitHub, the environment from the repository, personal taste from your account.

The Universal Image, When the Repository Says Nothing

A repository with no configuration opens on the default image, called universal. It ships Python, Node, PHP, Java, Go, C++, Ruby, .NET, Git and the GitHub CLI (GitHub Docs). The current version runs Ubuntu 24.04, with Node 22 and 24 (devcontainers/images).

A cost detail few people mention: the universal base container doesn't count against your storage quota, even with features. With your own image, the whole container counts (GitHub Docs, billing).

devcontainer.json, the Environment's Contract

The file lives at .devcontainer/devcontainer.json or .devcontainer.json in the root, with alternatives allowed in subfolders one level deep. It follows the Dev Container Specification, an open spec (containers.dev): the same file works in local VS Code, IntelliJ IDEA, the Dev Container CLI, CodeSandbox and DevPod (containers.dev).

Features: Reusable Chunks of Setup

Features are "self-contained units of installation and configuration code" (GitHub Docs). Instead of a Dockerfile to install Terraform, one line points to the feature in the catalog.

Dotfiles and Secrets: What Belongs to You, Not the Project

  • Dotfiles: you point to a repository of yours and Codespaces runs its install.sh (or bootstrap.sh, setup.sh) in every new codespace. That same setting now also carries over to Copilot's cloud sandboxes (GitHub Docs, personalization).
  • User secrets: up to 100, up to 48 KB each, granted per repository, arriving as environment variables. They don't exist during the Dockerfile build or in features (GitHub Docs), so you can't bake a key into the image.

Ports: Private by Default, Public with Care

Run npm run dev and Codespaces generates an address like https://NAME-3000.app.github.dev. The port starts out private, visible only to you while logged in. Make it public and "anyone who knows the URL and port number" sees the app with no authentication (GitHub Docs, ports). A public port goes back to private when the codespace restarts.

What It Costs and How to Use It Free

The official table says "120 hrs", and almost every tutorial repeats the number without the multiplier.

Personal plan Compute per month Storage per month
GitHub Free 120 core hours 15 GB-month
GitHub Pro 180 core hours 20 GB-month

Source: GitHub Docs, Codespaces billing. The numbers haven't changed since free accounts got access in November 2022 (GitHub Changelog, 2022), and organizations get no free quota at all.

Core Hours, Translated Into Real Hours

The docs spell out the math: usage is active time multiplied by the machine's multiplier, "for example, a multiplier of 2 for a 2-core machine" (GitHub Docs).

Bar chart of real hours per month within the quota: on the Free plan, 60 hours with 2 cores, 30 with 4, 15 with 8 and 7.5 with 16; on Pro, 90, 45, 22.5 and 11.25
The same quota buys twice the hours every time you cut the cores in half.

On a 2-core machine, Free covers roughly 3 hours per working day. GitHub itself says the quota is meant for open source and personal projects: it's "not intended to be sufficient for your day-to-day work at no cost".

On storage, a 5 GB codespace sitting stopped all month eats 5 of your 15 GB-month; the repository, extensions, prebuilds and custom images all count. The quota runs out when either of the two is used up, with an email at 90% and 100%.

Without a Card, It Just Blocks

You can start "without providing any payment details" (GitHub Docs). Without a card, an exhausted quota blocks usage and nothing is charged: you export your changes to a branch or wait for the month to roll over.

Past the Quota

Machine Price per hour
2 cores US$0.18
4 cores US$0.36
8 cores US$0.72
16 cores US$1.44
32 cores US$2.88
Storage US$0.07 per GB-month

Two calculations to calibrate. Three hours a day, over 22 working days, on a 2-core machine is 66 hours, or 132 core hours: 12 over the Free quota, costing US$1.08 for the month. Four hours a day on a 4-core machine is 352 core hours: the 232 core hours of overage become 58 hours at US$0.36, or US$20.88.

Details Almost Nobody Tells You

  • Closing the tab doesn't stop it. "Closing a codespace does not stop the codespace" (GitHub Docs). It stays active until the idle timeout, which is 30 minutes by default and can go from 5 to 240 (GitHub Docs, timeout).
  • 12-hour maximum lifetime. A codespace lasts at most 12 hours, "even if you are actively using it" (GitHub Docs, lifecycle). A long build or a dev server left running overnight will stop.
  • 30-day retention. A stopped, unused codespace is deleted after 30 days, configurable from 0 to 30, even with changes that never made it to GitHub. You get an email one day before (GitHub Docs, deletion).
  • A rebuild wipes everything outside /workspaces.
  • Prebuilds multiply. A prebuild is a snapshot of the ready container, produced by a GitHub Actions workflow, that makes the codespace open much faster. By default it's created in every region and keeps 2 versions; the official example reaches 8 billed prebuilds (4 regions times 2 versions) (GitHub Docs, prebuilds). It uses storage without showing up under "Your codespaces", and postCreateCommand doesn't run in it (GitHub Docs).
  • Committing to a read-only repository creates a fork in your account.
  • GPUs are gone. The GPU machine type was discontinued on August 29, 2025, along with the retirement of the Azure VMs behind it (GitHub Changelog, 2025). For training models, Codespaces is no longer an option.
Cartoon of a taxi parked at night, the passenger asleep in the back seat and the driver reading, while the meter on the dashboard spins so fast it gives off smoke and coins
Closed the tab and went to bed? The codespace meter keeps running until the timeout. On 4 cores, every hour of napping counts as four.

Copilot and the AI Agent Inside (and Outside) the Codespace

Copilot comes in as an extension: GitHub.copilot in the devcontainer.json extensions applies to the whole project (GitHub Docs). The Codespaces quota pays for the machine, not the AI.

The agent is another story. Copilot coding agent was renamed Copilot cloud agent on April 1, 2026 (GitHub Changelog, 2026) and it doesn't run in your codespace. It works in a cloud sandbox, on a GitHub Actions runner (with sessions of up to 59 minutes) or in a remote environment you register (GitHub Docs, agent). Cloud sandboxes became available on every paid plan on October 28, 2026, and billing starts on November 23, 2026, drawn from the included Actions amount, not the Codespaces quota (GitHub Changelog, 2026). A 2 vCPU, 4 GiB sandbox runs about US$0.22 an hour (GitHub Docs), close to the price of 2 Codespaces cores.

There's a bridge between the two, and few people know about it: a codespace can become the agent's environment. Add the ghcr.io/github/copilot-host/copilotd:0 feature to devcontainer.json; when the container starts, the copilotd host registers itself (GitHub Docs, custom environment). For me, that's the best new reason to keep devcontainer.json up to date: it describes the person's environment and the agent's. I wrote about splitting work between people and agents in AI coding agents on a frontend team.

Step by Step: Your First Codespace

  1. Open the github/haikus-for-codespaces template and click Use this template > Open in a codespace. On a repository of your own, the path is Code > Codespaces tab > Create codespace on main.
  2. Wait for VS Code to open in the browser and run npm run dev in the terminal.
  3. A notice appears saying the app on port 3000 is available, with an Open in Browser button.
  4. Done? At github.com/codespaces, click the three dots and then Stop codespace. Closing the tab isn't enough.

Source for the walkthrough: the official quickstart.

A Minimal devcontainer.json for Node or Next

Something I found while researching: the official Codespaces Node guide still shows the javascript-node:0-18-bullseye image in its example, with "18 (default)" on the selection screen (GitHub Docs, Node.js). Node 18 reached end of life on April 30, 2025 (Node.js Release). The typescript-node image currently has 22, 24 and 26 variants (devcontainers/images):

jsonc
{
  "name": "next-app",
  "image": "mcr.microsoft.com/devcontainers/typescript-node:24-bookworm",
  "forwardPorts": [3000],
  "portsAttributes": {
    "3000": { "label": "next dev", "onAutoForward": "openBrowser" }
  },
  "postCreateCommand": "npm ci",
  "customizations": {
    "vscode": {
      "extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
    }
  }
}

The trade-off: this custom image counts in full against your storage. If you live inside the free quota, "image": "mcr.microsoft.com/devcontainers/universal:latest" with the same postCreateCommand saves GB-months, at the cost of a much larger image when someone runs the same file outside Codespaces. If next dev doesn't answer on the forwarded address, make it listen on 0.0.0.0.

How Not to Blow the Quota

When It's Worth It and When It Isn't

Situation Worth it? Why
Team onboarding Yes Nobody loses day one installing dependencies
Course, workshop, class Yes Every student on the same version
Weak computer or Chromebook Yes The heavy machine is the one in the cloud
Reviewing a big PR Yes The branch runs in a clean environment, without touching yours
Trying an unfamiliar repository Yes, carefully VM isolated from your local files; don't grant secrets
8 hours of daily work Depends You're past the quota in week two
Unstable internet No No connection, no editor
Windows or macOS apps, native iOS No The remote container is always Linux
AI on a GPU No GPU machines discontinued in 2025

On my side: my projects run on my own server, a VPS, and I edit through VS Code connected over SSH. For someone working every day on the same projects, a fixed server costs less than Codespaces hours and doesn't delete anything after 30 days. In exchange, I deal with updates, full disks and contended CPU, things Codespaces handles on its own. I'd use Codespaces without a second thought to open an unfamiliar repository, for a course, and for someone who needs to be productive on day one. If the question is the cost of a project as a whole, I cover that in how much it costs to build software.

Alternatives in November 2026

Plenty of comparisons still list products that have shut down.

Option Where it runs Checked status Who it's for
Dev Containers in VS Code Your machine, with Docker Active; needs Docker on the machine (VS Code) Good machine, same devcontainer.json, no cloud
Coder Community Your infrastructure Open source (AGPL-3.0), free, release v2.38.10 on November 16, 2026 (Coder) Teams that want the model on their own server
DevPod Local or a cloud of your choice Last release on June 23, 2025, pre-release (GitHub) Stalled; I wouldn't start anything new on it
Gitpod / Ona Cloud Gitpod became Ona in 2025; Ona joined OpenAI and Ona Cloud shut down on October 31, 2026 (Ona) No longer an option for individual use
Firebase Studio (formerly Project IDX) Google's cloud No new workspaces since June 22, 2026; shuts down and deletes data on March 22, 2027 (Firebase) Only for people who need to migrate what they have
StackBlitz / WebContainers Inside your browser Active; Node running in the browser, performance depends on your machine (WebContainers) Demos, bug repros, small front-end work
Replit Cloud Plans from US$20/month; focused on an agent that builds the app (Replit) A different category: building apps by chatting

StackBlitz and CodeSandbox are in the site's tools catalog, with what each one does well.

Pitfalls

Frequently Asked Questions

Is GitHub Codespaces free?

For personal accounts, yes, up to the monthly quota: 120 core hours and 15 GB-month on Free, 180 and 20 on Pro. A core hour is time times cores: on Free, that's 60 real hours with 2 cores or 30 with 4.

Does Codespaces charge me if I don't add a card?

No. Without a payment method, an exhausted quota blocks usage until the month renews.

Does closing the browser tab stop the codespace?

No. It stays active until the idle timeout, 30 minutes by default. To stop it right away, use Stop codespace at github.com/codespaces or gh codespace stop.

Why did my storage run out if I deleted my codespaces?

It's almost always prebuilds: copies per region and version, billed even with no codespace open and missing from the codespaces list.

What's the difference between Codespaces and Dev Containers in local VS Code?

Both read the same devcontainer.json. Locally, the container runs on your machine's Docker at no cost; in Codespaces, it runs on a GitHub VM billed by the hour once you're past the quota.

Can I use Codespaces with a GPU for AI?

Not anymore. The GPU machine type was discontinued on August 29, 2025.

Does Copilot cloud agent use my Codespaces quota?

No. The agent runs in a cloud sandbox or on an Actions runner, with its own billing starting November 23, 2026, drawn from the included Actions amount. You can register a codespace as its environment with the copilotd feature, and then that codespace uses your quota as usual.

References

Source: https://ramongomessilva.com.br/blog/github-codespaces-explained · Accessed on December 02, 2026

Share Share on LinkedIn Share on X
Cite this article

Ready-made reference, with today as the access date.

ABNT

Brazilian standard (NBR 6023). Use it in theses and academic papers submitted in Brazil.

GOMES, Ramon. GitHub Codespaces: what it is, what it costs, how to use it free. Ramon Gomes, 19 nov. 2026. Disponível em: https://ramongomessilva.com.br/blog/github-codespaces-explained. Acesso em: 2 dez. 2026.

APA

American Psychological Association style. Common in scientific papers and journals, especially in the social, behavioral and health sciences.

Gomes, R. (2026, November 19). GitHub Codespaces: what it is, what it costs, how to use it free. Ramon Gomes. https://ramongomessilva.com.br/blog/github-codespaces-explained

BibTeX

Format for LaTeX users (Overleaf, for example). Paste it into your .bib file or import it into Zotero or Mendeley.

@online{gomes2026githubcodespacesexplained,
  author = {Gomes, Ramon},
  title = {{GitHub Codespaces: what it is, what it costs, how to use it free}},
  organization = {Ramon Gomes},
  year = {2026},
  month = nov,
  date = {2026-11-19},
  url = {https://ramongomessilva.com.br/blog/github-codespaces-explained},
  urldate = {2026-12-02}
}
Found a mistake?

Wrong fact, broken link, outdated information: tell me and I will fix it.

10 to 2,000 characters. If you can, point to the right source.

Only so I can reply. It never shows on any page of the site.

Written by

Ramon Gomes

Software Engineer

Full stack software engineer. I like taking a messy problem, listening to the people who live with it and shipping something that holds up day to day. These days I split my time between my own products, applied AI and client work.

Available for projects

Need Something Like This Built?

I build websites, systems, apps and AI automations, from design to deploy. Tell me what you need or see what I offer.

Related Articles