Free tool
GitHub HTML preview.
GitHub shows an .html file as source. Paste its link and see the page instead, with the stylesheets, scripts and images committed next to it. Then send the preview, or turn it into a link people can comment on.
Works with file, folder and repository links on github.com, raw.githubusercontent.com and gists.
Reviewing this page with someone?
Save this version as a Comma link. Readers open it on any device, no GitHub account, and comment on the exact line or chart. No account needed for a 7-day link.
Links it understands
- A file:
github.com/owner/repo/blob/main/docs/report.html - A folder or a whole repository, which opens its
index.html:github.com/owner/repo/tree/main/site - A raw link:
raw.githubusercontent.com/owner/repo/main/index.html - A gist:
gist.github.com/user/1a2b3c…(inline CSS and scripts only, gists have no folders) - A preview link from this page:
commareports.com/tools/github-html-preview?url=…
How it differs from htmlpreview.github.io
htmlpreview fetches the file and then each stylesheet and script one by one, rewriting them into the page, so fonts, fetch() calls to data files and anything loaded late tend to break. Here the page gets a <base> on jsDelivr’s mirror of the repository, which serves every file with its real type, so relative paths work the way they did on your machine. The comparison of htmlpreview.github.io alternatives and raw.githack alternatives covers GitHub Pages and the other options.
Questions
- How do I preview an HTML file from GitHub?
- Copy the file's address from GitHub (the page that shows the source, a raw.githubusercontent.com link, a folder, or a gist) and paste it into the box on this page. The page renders with its committed stylesheets, scripts and images. Nothing to install, no account.
- Why does GitHub show my HTML as code instead of a page?
- GitHub renders Markdown, but serves every other file as source, and raw.githubusercontent.com sends HTML as plain text with a no-sniff header so browsers won't run it. That is a safety choice: it stops anyone hosting live pages on github.com. A previewer fetches the file and renders it somewhere else.
- Why do the CSS and images load here when they break on htmlpreview.github.io?
- Relative references resolve against jsDelivr's mirror of the same repository, which serves each file with its real content type. Stylesheets, scripts, images, fonts and data files fetched with a relative path all load from the commit you linked.
- Can I preview HTML from a private repository?
- No. The preview reads the public raw file, so a private repository returns not found. Download the file (or the folder) and open it in the HTML viewer or the HTML inliner, or publish it to Comma, where the link can stay private or invite-only.
- Can I send someone the preview?
- Yes, two ways. Copy preview link gives a commareports.com address that re-fetches the file from GitHub each time it opens, so it follows the branch. Get a shareable link saves this version as a Comma page that readers can comment on, line by line, without a GitHub account.
- Is it safe to preview HTML from someone else's repository?
- The page runs in a sandboxed iframe with scripts on but no same-origin access, so it cannot read this site's cookies or storage, submit forms, open popups or move this tab. A banner names the repository it came from. Don't type passwords into a page you are previewing.
- Why does a link inside the preview show plain text?
- Clicking a link to another .html file navigates the sandboxed frame straight to the CDN, which serves HTML as text. Paste that page's GitHub address into the box instead. Assets and fetch() calls are unaffected.
Related: HTML viewer · HTML inliner · HTML file shows code instead of the page · GitHub Pages alternatives · publish an HTML report from GitHub Actions · all free tools