Skip to content
Compare

How to host HTML on GitHub Pages

GitHub Pages is the classic free, permanent home for a static site. The exact clicks to publish an HTML file or folder, the path and case rules that trip people up, and when an instant link is the better tool.

7 min readUpdated October 2026By the HTMLtoLink team
Short answer

Create a public GitHub repository, upload index.html and your other files with Add file → Upload files, then open Settings → Pages, choose Deploy from a branch, select main and / (root), and save. About a minute later the site is live at https://username.github.io/repository/. It is free and permanent, but public and indexed — for a quick private share, an instant link is faster.

Step by step (no command line)

  1. Sign in to GitHub (or create a free account).
  2. Click New repository. Give it a short lowercase name — it becomes part of the URL — and keep it Public. GitHub Pages on private repositories requires a paid plan.
  3. On the empty repository page choose uploading an existing file, drag in the contents of your site folder (so index.html sits at the top), and commit.
  4. Go to Settings → Pages. Under Build and deployment, set Source to Deploy from a branch, pick main and / (root), and save.
  5. Wait a minute and refresh the Pages settings. The live URL appears at the top.

Name the repository username.github.io and the site is served at the root, https://username.github.io/, instead of a sub-folder.

Why the page loads without CSS or images

A normal (project) Pages site lives in a sub-folder: /repository/. So a root-absolute path such as /css/style.css points at username.github.io/css/style.css — outside your site — and 404s. Use relative paths (css/style.css). The other classic causes are case mismatches (GitHub Pages is case-sensitive) and files left out of the upload; the ZIP site checker catches all three before you commit.

Folders starting with an underscore

By default Pages runs your files through Jekyll, which ignores files and folders beginning with _ (common in exported sites, e.g. _next/ or _assets/). Add an empty file named .nojekyll to the top of the repository to serve everything as-is.

Limits worth knowing

  • Published sites should stay under about 1 GB, with a soft bandwidth limit of about 100 GB per month.
  • Static files only — no server-side code.
  • Sites are public and normally indexed by search engines.
  • Changes go live after a short build, usually under a minute.

Check GitHub's own Pages documentation for the current limits.

Choose GitHub Pages for a portfolio, documentation or project site you want to keep for years, under version control, possibly with your own domain. Choose an instant link when you want someone to see a page now, privately, without accounts — and especially for client drafts (password), classroom activities (QR code) or AI-generated pages you will tweak a few times. The full comparison is in HTML hosting compared.

Questions people ask

Is GitHub Pages free?

Yes, for public repositories. Publishing from a private repository needs a paid GitHub plan.

How long does GitHub Pages take to update?

Usually under a minute after you commit. A hard refresh (Ctrl/Cmd+Shift+R) avoids seeing a cached copy.

Why does my GitHub Pages site show a 404?

Most often there is no index.html at the top of the published branch/folder, or Pages is not enabled yet. Check Settings → Pages and the file location.

Read next

Your HTML deserves a real link

Paste code, drop a file, a ZIP or a whole folder — get a live URL with your own address, an optional password and a QR code. Free to start with Google sign-in; paid plans keep links online for good.

Turn HTML into a link