Skip to main content

Adding an "Open in GitHub Codespaces" badge

You can add a badge to a Markdown file in your repository which people can click to create a codespace.


Adding an "Open in GitHub Codespaces" badge to a Markdown file gives people an easy way to create a codespace for your repository.

Screenshot of an "Open in GitHub Codespaces" badge on a README page.

When you create a badge you can choose specific configuration options for the codespace that the badge will create.

When people click the badge they'll be taken to the advanced options page for codespace creation, with the options you chose preselected. For more information about the advanced options page, see "Creating a codespace for a repository."

From the advanced options page, users can change the preselected settings if required, then click Create codespace.

Creating an "Open in GitHub Codespaces" badge

  1. On, navigate to the main page of the repository.

  2. Under the repository name, click the button labeled with the name of the current branch and, in the dropdown menu, select the branch you want to create the badge for.

    Screenshot of the expanded branch dropdown menu, listing various branches. The dropdown menu, labeled with a branch icon and "trunk," is highlighted with a dark orange outline.

  3. Click the Code button, then click the Codespaces tab.

  4. At the top right of the Codespaces tab, select and click New with options.

    Screenshot of the options dropdown in the "Codespaces" tab, showing the option "New with options."

  5. On the advanced options page for codespace creation, select the values you want to be preselected in each field.

    Screenshot of the advanced options page with dropdown menus for "Branch," "Dev container configuration," "Region," and "Machine type."

  6. Copy the URL from the browser's address bar.

  7. Add the following Markdown to, for example, the file of your repository:

    [![Open in GitHub Codespaces](](COPIED-URL)

    For example:

    [![Open in GitHub Codespaces](](

    In the above example, 0000000 will be the reference number of your repository. The other details in the URL are determined by the values you selected in the fields on the advanced options page.