How to open an HTML file on a phone

You can open an HTML file on a phone, but not by tapping it in mail. Save it first, then use the Files preview on iPhone or Open with Chrome on Android. Scripts and separate stylesheets may still be missing; a link avoids all of it.

To open an HTML file on a phone, save it to the phone first, then open it from the Files app on iPhone or from the file manager with Chrome on Android.

An HTML file on a phone: it downloaded, and now nothing offers to open it. (Illustration.)
An HTML file on a phone: it downloaded, and now nothing offers to open it. (Illustration.)

Tapping the attachment in mail rarely works, and even the routes that do work render the page with limits.

This guide gives the steps for each platform, what each one does and does not show, and the one route that behaves the same on every phone.

Why a phone does not just open it

A desktop keeps a table of "this extension opens with that program", and a browser is an ordinary program that can be pointed at a local file. Phones work differently.

Apps are sandboxed, and the browser registers itself for web addresses, not for files sitting in shared storage. So a downloaded .html file has no default owner, and a tap in the mail app often does nothing at all.

That is also why the answer differs by platform. iPhone solves it with a built-in preview. Android solves it by asking which app should take the file. Neither is wrong; they just need one extra step that a link does not.

How to open an HTML file on an iPhone

  1. Save the attachment to Files. In Mail, tap the attachment, then the share button, then Save to Files. In most chat apps the share sheet has the same option. Pick Downloads or any folder.
  2. Open the Files app and tap the file. Files renders HTML in its preview. Headings, text, tables and any styles written inside the file all show.
  3. Check what is missing. The preview may not run scripts, so a chart drawn by JavaScript can stay blank. It also loads nothing from other files, so a page that reaches for styles.css next to it shows unstyled.
  4. For a page that needs scripts, hand it to a viewer app. Tap the share button in the preview and choose an HTML viewer app you have installed. Check that it runs scripts; not every viewer does.
iPhone: save it to Files first, then tap it there. The preview may not run scripts. (Illustration.)
iPhone: save it to Files first, then tap it there. The preview may not run scripts. (Illustration.)

Safari is not a dependable route here. Apple does not document opening a local file by typing a file:// path, and whether a browser is offered for a local file varies. The Files preview or a viewer app are the dependable options.

How to open an HTML file on Android

  1. Download the attachment. Gmail and most chat apps save it to the Download folder.
  2. Open the file manager and tap the file. On a Pixel that is Files; on a Samsung phone it is My Files. Tapping a .html file brings up an Open with sheet.
  3. Pick a browser from the sheet. A browser opened this way usually renders the file with the styles inside it applied and scripts running.
  4. If no browser is offered, type the path. Open Chrome and enter file:///sdcard/Download/ followed by the file name. This works on many phones. On a few phones with strict storage rules the browser reports the file as not found; the Open with route or a viewer app still works there.
Android: from the file manager, tap the file and choose a browser from the Open with sheet. (Illustration.)
Android: from the file manager, tap the file and choose a browser from the Open with sheet. (Illustration.)

Which apps appear in the sheet depends on the phone maker and what is installed, not on the file. The same attachment offers Chrome on one phone and nothing on the next. If you are sending the file to someone, that is the part you cannot control.

Opening it from mail or a cloud drive

The two places people tap first are the two that work least. In some mail apps on Android, tapping a .html attachment downloads it rather than showing it, so you are back at step 1.

In Mail on iPhone, the tap opens a preview similar to the one Files shows, with the same limits.

A file sitting in a cloud drive depends on the drive app: some show a preview, some only offer a download, and a downloaded copy then needs one of the routes above. Save first, then open from Files or the file manager.

Why the page can open and still look wrong

Getting the file open is half of it. Three things commonly go wrong afterwards.

The stylesheet is in another file. A page exported by a tool often comes as report.html plus a folder of styles and images. Only the .html file was sent, so the phone renders bare text. The fix is a self-contained file, with styles inside it and images at public addresses.

The page has no viewport line. Without it, the phone assumes a desktop-width page and shrinks the whole thing to fit, which produces text too small to read. One line in the head fixes it:

<meta name="viewport" content="width=device-width,initial-scale=1">

See the viewport meta tag for what the values mean.

Scripts may not run. The iPhone Files preview may not run JavaScript, so anything drawn or filled in by a script can be missing. A viewer app, or a link, brings it back.

The honest summary

Route iPhone Android
Tapping the attachment in mail Preview, sometimes Downloads it, usually
Saving, then tapping in the file manager Renders, scripts may not run Renders in a browser if one is offered
Typing a file:// path in the browser Not a documented route Often, depending on the browser and phone
A viewer app Depends on the app Depends on the app
Opening from a cloud drive Depends on the drive app Depends on the drive app
Opening an https:// address Always, scripts on Always, scripts on

The last row is the entire point. No saving, no Open with sheet, no app to install, and no difference between phone models. A link is the one thing every phone handles identically.

If you are the one sending it, do not send the file

Everything above is what the recipient has to do. If they might be on a phone, and outside a desk job they usually are, an HTML attachment is close to unopenable for them. Publish the page and send the address.

The same page sent as a link. Every phone renders a link with scripts on.
The same page sent as a link. Every phone renders a link with scripts on.
.html file sitting on your disk drop Hosted page served over https get link Shareable URL opens on any device
The same HTML, served at an address instead of handed over as a file. The phone treats it like any other link.

Turning the page into a link takes one paste and removes the whole class of problem.

It opens on a phone with scripts on, it renders at phone width if the page carries the viewport line, and chat apps draw a preview card for it.

In NOS the pasted HTML becomes a page at its own address, and the address does not change when you revise, so the link you sent before the train journey still shows the corrected numbers afterwards.

Before you send: a 20-second check

  • Is it one file? Styles inside it, images embedded as data URIs or uploaded to NOS. If it came with a folder, it is not one file yet.
  • Does the head have the viewport line? If not, add it.
  • Does it need scripts? If yes, do not rely on the iPhone preview. Send an address.
  • Will it change? Then send an address that stays the same after edits, so nobody is holding an old file.

Questions people ask

Why will my phone not open the .html file I downloaded?

Phones associate file types with apps, and the browser only registers itself for web addresses, not for files in storage. So a downloaded .html file has no default owner. It has to be opened from a file manager, or through a browser pointed at its path.

How do I open an HTML file on an iPhone?

Save it to the Files app, then tap it. The preview shows the page with the styles that are inside the file, but it may not run scripts. For a page that needs scripts, try an HTML viewer app, and check that it runs scripts before relying on it.

How do I open an HTML file on Android?

Open the file manager, tap the .html file and pick a browser from the Open with sheet. If no browser is offered, open Chrome and type file:///sdcard/Download/ followed by the file name in the address bar.

Why does the page look broken on my phone even though it opened?

Two usual reasons. The page loads a stylesheet or images from separate files that were not sent with it, or it is missing the viewport line, so the phone renders it at desktop width and shrinks it. A self-contained page with a viewport tag renders normally.

What always works on every phone?

A web address. Every phone opens links the same way, with scripts on and nothing to save or choose. Publish the page and send the link.

Keep reading