How to Open an HTML File Someone Sent You

· · Updated

An HTML file is a web page that has not been served yet, which is why it behaves oddly when it arrives as a file. It shows code, or downloads instead of opening, or renders as a plain-text skeleton with no styling. This covers how to open it properly and what to do when it still looks wrong.

The Problem

Three symptoms, three distinct causes. Identifying which one you have saves the guesswork.

You see code. A wall of <div> and <span>. The file opened in a text editor, a code editor, or a preview pane instead of a browser. Nothing is wrong with the file.

The page renders but looks broken. Text stacked in one column, default fonts, no images, no colours. The file loaded, but the CSS, JavaScript, and images it references were not sent alongside it. The page is asking for styles.css and there is nothing to load.

Nothing happens, or it downloads again. Usually a security control: the mail provider or browser is treating the HTML attachment as risky, which is a reasonable thing for it to do.

How to Open It

On Windows

  1. Save the file somewhere you can find it, like the Desktop.
  2. Double-click it. If your default association for .html is a browser, it opens as a page.
  3. If it opens in Notepad or an editor: right-click → Open with → choose Chrome, Edge, or Firefox.

On macOS

  1. Save the file to Downloads or Desktop.
  2. Double-click. If it opens in TextEdit, right-click → Open With → Safari or Chrome.
  3. To stop it happening again: right-click → Get InfoOpen with → pick a browser → Change All.

On iPhone or Android

Be honest with yourself about this one. Mobile operating systems make opening a local HTML file deliberately difficult, and from a mail attachment it often is not possible at all. There are file-manager apps that can do it, and installing one to read a colleague’s page is not a reasonable ask.

The correct move is to reply and ask for a link. Anything hosted opens in a mobile browser instantly, fully interactive, with nothing to download.

From inside a zip

Unzip it first. Do not open the HTML from a preview of the archive — the browser will not be able to reach the sibling CSS and image files, and you will get the unstyled version.

Look for index.html at the top level of the unzipped folder and open that.

If It Still Looks Wrong

No styling. The sender sent one file out of several. Ask for the whole folder as a zip, or better, a hosted link.

Images are broken. Same cause. The <img> tags point at files that are not there.

Interactive parts do nothing. Either the JavaScript file is missing, or the page loads a library from a CDN and you are offline. Check your connection first.

A login form appears. Stop. This is the classic HTML-attachment phishing pattern: a local file that renders a pixel-perfect fake login page, where the address bar shows a file path so the usual “check the URL” advice is no help. Never type credentials into a page you opened from your own disk.

Everything above is you doing work that the sender could have avoided with one step. If they host the file and send a URL:

  • It opens in one click, on any device.
  • All the CSS, JavaScript, and images come with it, so it looks the way they intended.
  • It works on your phone.
  • There is no security warning, because you are visiting a normal web address.
  • On a platform like Undraft, you can also leave comments directly on the page instead of writing an email describing where things are.

If you receive HTML attachments regularly, it is worth saying this once. It is a small change on their end and it removes the whole problem.

Examples

The unstyled-page case

  1. You receive dashboard.html and open it.
  2. It renders as plain text in a single column.
  3. You reply asking for the CSS.
  4. They send four more files.
  5. You put all five in one folder and open the HTML again — now it works.

Three exchanges to view one page.

  1. They upload the folder and send a link.
  2. You click it. The page loads, styled, interactive.
  3. You click the chart you have a question about and leave a comment there.

Summary

  • Open it with a browser, not an editor — right-click, Open With, and pick Chrome, Edge, Safari, or Firefox.
  • Check whether assets are missing — an unstyled page means the CSS and images were left behind; ask for the whole folder or a link.
  • Avoid entering credentials into a locally opened HTML file — that is the exact shape of an HTML-attachment phishing attack.

Next: if you are the one sending, see how to share an HTML file as a live link so nobody has to do any of this.

Frequently Asked Questions

How do you open an HTML file?

Save it to your computer and open it with a web browser — double-click usually works, or right-click and choose Open With, then your browser. Opening it in a text editor shows the source code instead of the page.

Why does the HTML file show code instead of a webpage?

Because it opened in a text editor or a preview pane rather than a browser. The file is correct; the application reading it is wrong.

Why does the page look unstyled and have no images?

The file references separate CSS, JavaScript, and image files that were not sent with it. HTML that depends on a folder of assets needs the whole folder, with the structure intact.

How do you open an HTML file on a phone?

It is awkward on both iOS and Android, and often not possible from a mail attachment. The practical answer is to ask the sender for a hosted link instead — that opens in a mobile browser with no download at all.

Is it safe to open an HTML file from an email?

Treat it with suspicion. HTML attachments are a common phishing vector because they can render a convincing fake login page from your own disk, where checking the address bar does not help. Never enter credentials into a page you opened as a local file.

More on this topic: Sharing HTML Files

A

Founder at Undraft · Product manager

Built Undraft after watching prototype review break down into screenshots and ZIP attachments one too many times. Writes from direct experience running the product.

More posts by Ari Kliger