How to view an HTML file on GitHub as a web page, not code
Quick answer
GitHub shows an .html file in a repository as code, and its Raw button serves the file as plain text, so the browser shows the code there too. To see the page run, download the raw file and open it in your browser, publish the repository with GitHub Pages (public repositories on GitHub Free), or upload the file to an HTML host for a link anyone can open.
Free plan: no credit card, 1 published page.
On this page
You opened an .html file in a GitHub repository, maybe a page Claude Code or Codex committed, a classmate's project, or an example from a tutorial, and GitHub showed you its code. That's how GitHub shows HTML: it renders Markdown, CSV tables, PDFs, images, and notebooks, and HTML isn't on that list. This guide gives the ways to see the page itself, from GitHub's documentation and our check of GitHub's file server, both on November 20, 2026.
The quickest is the upload box at the top of this page: download the file from GitHub, drop it in, and you get a preview link without an account. That preview runs no scripts. Click Keep this page — free, no card and sign up, and the page moves into your account, where its scripts run and you can publish it at a link.
Why GitHub shows the code
GitHub's documentation lists the non-code files it renders: images (PNG, JPG, GIF, PSD, and SVG), 3D .stl files, CSV and TSV tables, PDFs, prose documents such as Markdown, GeoJSON maps, and Jupyter notebooks. An .html file shows as code, with line numbers.
The Raw button doesn't run it either. GitHub's documentation says the raw view lets you "view or copy the raw content of a file without any styling." On November 20, 2026, we asked GitHub's file server for an HTML file's raw address. It answered with:
| Header | Value | What it does |
|---|---|---|
content-type | text/plain; charset=utf-8 | The browser shows the file as text |
x-content-type-options | nosniff | The browser doesn't guess that it's HTML |
content-security-policy | default-src 'none'; style-src 'unsafe-inline'; sandbox | Nothing on the page loads or runs |
So every browser shows the code at a raw address. To see the page, it needs to come from a place that serves it as a web page: your own computer, GitHub Pages, or an HTML host.
Download the file and open it
- On GitHub, click the file.
- In the upper-right corner of the file view, click the download icon beside Raw: GitHub's documentation says it downloads the raw file.
- Open the downloaded file in Chrome, Edge, Safari, or Firefox: double-click it, or press Ctrl + O (Cmd + O on a Mac) in the browser.
For a whole project, click Code above the list of files, then Download ZIP, unzip it, and open the .html file from its folder, so the CSS, scripts, and images beside it load too. A page that fetches data files or uses module scripts needs a local server: How to open an HTML file has the steps for each device and browser.
On an iPhone, a downloaded file opens as a Quick Look preview, which ran no JavaScript in our iPhone test. Open it in the free HTML viewer instead: tap Choose an .html file, and the page runs in your browser. The file isn't uploaded.
Turn on GitHub Pages
GitHub Pages is GitHub's own way to serve the files as a website. GitHub describes it as "a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub".
- On GitHub, go to the repository, and under its name, click Settings.
- In the "Code, planning, and automation" section of the sidebar, click Pages.
- Under "Build and deployment", under "Source", select Deploy from a branch.
- Choose the branch, and a folder if you want one, then click Save.
- Back on that settings page, under "GitHub Pages", click Visit site.
What GitHub's documentation says about it:
- Which repositories. "GitHub Pages is available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server."
- Who sees it. "GitHub Pages sites are publicly available on the internet, even if the repository for the site is private".
- The address. A project's site is at
<owner>.github.io/<repositoryname>, and its entry file is "an index.html, index.md, or README.md file". Another file is at its own path, such as/<repositoryname>/quiz.html. - How long. "It can take up to 10 minutes for changes to your site to publish after you push the changes to GitHub."
- What for. GitHub Pages "is not intended for or allowed to be used as a free web-hosting service to run your online business, e-commerce site, or any other website that is primarily directed at either facilitating commercial transactions or providing commercial software as a service (SaaS)."
GitHub Pages limits and GitHub Pages with a private repository go further.
Ways to see an HTML file from GitHub, compared
| Way | The page runs | Who can open it | What it takes |
|---|---|---|---|
| The file view on GitHub | No, it shows code | Anyone who can see the repository | Nothing |
| Raw | No, plain text | Anyone who can see the repository | Nothing |
| Download and open | Yes, on your computer | Only you | A browser; a local server for module scripts and data files |
| HTML viewer | Yes, in your browser | Only you | The downloaded file |
| GitHub Pages | Yes | Everyone on the internet | Repository settings; a public repository on GitHub Free |
| A link from an HTML host | Yes | Everyone with the link | One upload, no repository settings |
Get a link to the HTML file in 4 steps
Convika serves one .html or .htm file up to 2 MB, or pasted code, at a lasting link, with its HTML, CSS, and JavaScript as they are. It works for a file from a private repository, too, and needs no repository settings.
1. Get a preview link
Download the file from GitHub, drop it into the upload box at the top of this page, or paste the code from the file view, and click Get my preview link. You get a link in seconds, without an account. It works for 3 minutes, with scripts and forms off, so it's for checking the layout. If the page's CSS and images sit in a folder next to it, drop that folder, or a zip of it, and the box puts them inside the file.
2. Keep the page
Click Keep this page — free, no card and sign up. The page moves into your account, and its scripts run in the dashboard preview.
3. Publish it
Click Publish page. Under Who can open this page?, choose Public and click Next. The first time, click Publish free: the page goes live with a small Convika bar at the bottom. Under it, a second button buys the Pro pass ($5 once for 30 days, no auto-renewal) and publishes the page without the Convika bar. On Free, the page is Public: anyone with the link can open it, and it may show up in search results and in Convika's gallery. For a file from a private repository, choose Private link or Only people with the password (Pro) instead.
4. Send the link
Copy the page's address, such as yourpage.convika.page, and put it in the repository's README, an issue, or a chat. It opens as a web page in any browser. Free includes 1 published page and 10,000 page views a month, and the dashboard shows how many people opened it.
Skipbox
Cheap & fast GitHub Actions runners, unlimited for $39 a month
Your own machine keeps Docker layers and package caches between jobs. Switch by changing one runs-on line.
Start a free Skipbox trialFrequently asked questions
How do I view an HTML file in GitHub?
GitHub shows an .html file as code, and its Raw button shows it as plain text. To see the page, download the raw file with the icon beside Raw and open it in your browser, turn on GitHub Pages for the repository, or upload the file to an HTML host and open its link.
How do I preview an HTML file in GitHub without downloading it?
Turn on GitHub Pages: in the repository's Settings, click Pages, choose Deploy from a branch, pick the branch, and click Save. The page is then at <owner>.github.io/<repositoryname>/ and the file's path, within about 10 minutes, GitHub says. On GitHub Free, the repository has to be public.
Why does GitHub show my HTML code instead of the page?
GitHub renders Markdown, CSV, PDFs, images, notebooks, and a few other formats, and HTML isn't one of them. Its raw address is served as text/plain with nosniff and a sandboxing policy, as we checked on November 20, 2026, so the browser shows the code there too. Open the file from your computer or from a website instead.
How do I run an HTML file from a GitHub repository?
Download it, or the whole repository with Code > Download ZIP, and open the .html file in your browser. If it uses module scripts or fetches data files, run a local server in its folder first. To run it for other people, publish it with GitHub Pages or at a link from an HTML host.
Is GitHub Pages free?
Yes, for public repositories on GitHub Free and GitHub Free for organizations; private repositories need GitHub Pro, Team, or Enterprise. GitHub's documentation also says GitHub Pages isn't for running an online business, an e-commerce site, or commercial software as a service. GitHub Pages limits has its size and bandwidth limits.
Sources
- Working with non-code files (GitHub Docs) (read November 20, 2026)
- Viewing and understanding files (GitHub Docs) (read November 20, 2026)
- What is GitHub Pages? (GitHub Docs) (read November 20, 2026)
- Creating a GitHub Pages site (GitHub Docs) (read November 20, 2026)
- Configuring a publishing source for your GitHub Pages site (GitHub Docs) (read November 20, 2026)
- GitHub Pages limits (GitHub Docs) (read November 20, 2026)
- Downloading source code archives (GitHub Docs) (read November 20, 2026)
- The headers of
raw.githubusercontent.comforh5bp/html5-boilerplate/main/src/index.html(our check, November 20, 2026, 19:23 JST)
Next step
How to password protect an HTML page or website
A JavaScript password script leaves the password in the page source. To password protect an HTML page or link, encrypt the file or let a server check it.
Related articles
- How to open an HTML file on any computer, phone, or tabletDouble-click an .html file to open it in your browser. On a phone, open it in Convika's free HTML viewer. What an HTML file is, steps by device, and fixes.
- How to share an HTML file from VS Code as a link, with its CSS and JavaScriptLive Server's link opens only on your computer. To share an HTML file or a VS Code project as a link, put its CSS and JavaScript in one file and upload it.
- Claude Code or Codex made an index.html: how do I open and preview it?Open the index.html Claude Code or Codex wrote with open, start, or xdg-open, serve it at localhost:8000 if it loads other files, and see it on a phone.
- GitHub Pages alternatives for a one-page site (no git needed)Netlify, Cloudflare Pages, Vercel, Tiiny Host, Carrd, and Convika compared with GitHub Pages on git, forms, passwords, custom domains, and commercial use.
- Is GitHub Pages free? GitHub Pages limits on size, bandwidth, and buildsYes, GitHub Pages is free for public repositories on GitHub Free. Its size limit is 1 GB a site, with soft limits of 100 GB of bandwidth a month and 10 builds an hour.
- Can you use GitHub Pages with a private repo for free?On GitHub Free, a Pages repo must be public. Pro, Team, and Enterprise Cloud publish from private repos, and the site stays public outside Enterprise Cloud.