Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
GitHub’s normal file viewer cannot render an HTML file as a live webpage. A raw HTML URL is delivered as text/plain, so your browser displays the source code. For a durable, shareable preview, publish the repository with GitHub Pages. For a quick check, use a hosted preview service or a local browser workflow, choosing the local options when the repository or its data is private.
Why GitHub shows HTML code instead of the page
When you open an HTML file in GitHub’s repository interface, you are viewing a source document, not a deployed website. The Raw link also returns the file as plain text. Browsers therefore show tags such as <html>, <head>, and <body> instead of interpreting them as a page.
This is intentional: GitHub’s code viewer is for inspecting and editing files. It is not a web server for arbitrary HTML. To render the file, you need a service or local browser context that serves it with an HTML content type and resolves its linked CSS, JavaScript, images, and fonts.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsBest method for a permanent preview: GitHub Pages
GitHub Pages is GitHub’s static hosting service. It takes HTML, CSS, and JavaScript from a repository, optionally runs a build process, and publishes the resulting site. It is the right choice when you need a stable URL for teammates, a portfolio, documentation, or a project demo.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
1. Put the files in a repository
- Create a new repository or open an existing one.
- Commit your site files. A simple static site might contain
index.html,styles.css, anassetsdirectory, and JavaScript files. - Make sure the entry file is named
index.html,index.md, orREADME.mdin the published source root or generated artifact.
If your main file has another name, either rename it to index.html or configure a build step that emits an index file.
2. Select a Pages publishing source
- Open the repository on GitHub.
- Choose Settings, then Pages.
- Under the publishing source, select a branch and folder, such as the repository’s root or a
/docsfolder, or select a GitHub Actions workflow. - Save the setting and wait for GitHub to deploy the site.
The branch-and-folder option is convenient for a straightforward static site. Use Actions when you need a build command, a static-site generator, asset processing, or a separate deployment artifact.
3. Open the deployed URL
Return to Settings → Pages and select Visit site. A user or organization site normally uses a repository named <owner>.github.io and appears at https://<owner>.github.io. A project site normally appears at https://<owner>.github.io/<repositoryname>.
Recommended Free Tools
After a push, deployment can take up to 10 minutes. If the old version appears, wait for the deployment status to complete, then refresh without using a stale browser cache.
Important Pages limitations
- Pages hosts static output. It does not execute server-side PHP, Ruby, or Python. Replace those parts with client-side code or generate static files during a build.
- A Pages site is publicly available on the internet, even when its source repository is private under plans that permit private publication. Never commit API keys, passwords, private tokens, or personal data.
- Relative links are resolved from the deployed site’s path. A project site lives below
/repositoryname, so root-relative URLs such as/styles.csscan point to the wrong location. Prefer relative paths such asstyles.css, or configure your framework’s base path. - Case matters on the deployed server. A link to
Styles.csswill not reliably findstyles.css.
Quick preview for a public file: a hosted HTML preview service
For a one-off check, you can use the documented html-preview service. Copy the URL of the HTML file’s GitHub blob page and prepend https://html-preview.github.io/?url=. For example:
Rank #2
https://html-preview.github.io/?url=https://github.com/OWNER/REPOSITORY/blob/main/index.html
The service fetches the file through a CORS proxy and processes linked scripts, styles, frames, and other assets. It is useful when you do not want to configure Pages, but it is not the same as deploying your site.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallPrivacy and security warnings
- Do not use a public proxy for credentials, secrets, private customer data, or untrusted private-source material.
- The project warns that freely hosted CORS proxies can expose security-sensitive data. Cookies or
localStorageused by a script could become accessible to other repositories opened through the service. - Do not enter secrets while testing. Clear site data afterward if you used the service.
- Third-party previews may rewrite requests, block resources, or behave differently from your eventual production host.
Preview a private repository without sending source to a proxy
When the repository is private, keep processing on your machine whenever possible. Two practical options are a local Chrome extension and a local clone.
Chrome extension workflow
The GitHub Local HTML Preview extension adds a Preview button beside Raw on .html and .htm blob pages. It can work with private repositories that your current GitHub session can already open.
- Open the HTML file’s GitHub blob page.
- Click Preview beside Raw.
- Review the rendered result with active content disabled first.
- Use Allow active content only when you understand the file and need its scripts or HTTPS assets.
By default, the extension allows inline CSS and data/blob assets while blocking scripts and external resources. That conservative behavior is safer for unknown code, but it means an application that depends on JavaScript, remote fonts, APIs, or third-party styles may not look complete until you explicitly allow those resources.
Rank #3
Local clone and browser workflow
- Clone or download the repository to your computer.
- Open the HTML file in a browser, or serve the directory with the local development server provided by your editor or framework.
- Inspect the page and its relative assets from the same directory.
Opening a file directly with a file:// URL is adequate for simple markup, but browser security rules can block module scripts, fetch requests, fonts, or other features. A local HTTP server more closely matches deployment. A local preview can still differ from GitHub Pages because server-relative paths, headers, redirects, and origin rules are not identical.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Which preview method should you choose?
| Need | Recommended path | Why |
|---|---|---|
| Stable link for teammates or a portfolio | GitHub Pages | Official static hosting with a predictable github.io URL |
| Fast check of a public file | Hosted HTML preview | No repository configuration, but it introduces proxy and privacy risk |
| Private source or sensitive content | Local extension or local clone | Processing stays closer to your machine |
| Full browser behavior and scripts | GitHub Pages or a controlled local server | These provide a normal HTTP page instead of a restricted proxy preview |
Common problems and fixes
The Pages URL returns a 404
Confirm that Pages is enabled for the intended repository and that the selected branch and folder contain index.html, index.md, or README.md. Check the Pages deployment status, then wait for propagation. For a project site, verify that you are using the repository path after the hostname.
The page loads but CSS, images, or JavaScript are missing
Inspect the browser’s network panel and compare each request with the deployed URL. Fix capitalization mismatches, use paths relative to the current document, and account for the project-site prefix. A link beginning with / points to the domain root, not necessarily the repository site.
JavaScript works locally but not in a hosted preview
The hosted preview extension blocks scripts and external resources by default. Enable active content only for code you trust. A CORS preview can also alter or block requests. Test the complete behavior through GitHub Pages or a controlled local HTTP server.
Changes are not visible
Check that the commit reached the branch selected in Pages, wait for deployment to finish, and refresh after clearing the browser cache. If an Actions workflow is configured, inspect its run for build errors and confirm that the generated artifact contains the expected files.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
The HTML contains server-side code
GitHub Pages will not execute PHP, Ruby, or Python. Move that logic into a supported build step that produces static files, or host the application on a platform that runs the required server.
A private file cannot be previewed
Use the local extension while signed in to GitHub or clone the repository locally. Do not paste a private URL into a freely hosted proxy. Remember that publishing the result with Pages makes the site publicly reachable.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
For automated captures, ScreenshotNeo returns a screenshot or PDF from one request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing result in X-Page-Verdict and X-Billed headers.
Use it when you need a rendered image of a public GitHub Pages URL rather than a manually inspected browser tab. The service supports full-page capture, lazy-image loading, CSS-selector element capture, device presets, arbitrary viewports, retina scale, PDF output, custom CSS and JavaScript, click actions, waits, request blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, configurable caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify migration.
Every plan includes the features. The free plan provides 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
See the ScreenshotNeo documentation for request options and authentication. A minimal cURL request is:
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Create a free ScreenshotNeo account to get 1,000 screenshots each month with no card.
FAQ
Can I open a GitHub HTML file directly in Chrome?
You can open the source URL, but GitHub serves it as plain text, so it will not behave as a live page. Use Pages, a local workflow, or a preview service instead.
Does GitHub Pages support a private website?
Pages sites are publicly available on the internet, including sites published from private repositories under plans that allow private publication. Treat the deployed URL as public.
How long does a GitHub Pages deployment take?
GitHub’s documentation says a pushed change may take up to 10 minutes to publish.
Will a preview extension run my JavaScript?
Not by default. The documented extension blocks scripts and external resources until you explicitly allow active content.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

