TROUBLESHOOTING

How to open an HTML file on a Mac (in Safari, Chrome or any browser)

You saved an .html file, or an AI tool gave you one, and your Mac opens it as code, as a flat preview or not at all. The ways to open it in a browser, the fixes for common snags, and how to send it to someone else.

4 min read·

On a Mac, double-clicking an .html file opens it in whatever app is set as its default. On a fresh Mac that is Safari, but installing Xcode, a code editor or another browser can change it, and then the file opens as code. Pressing the space bar in Finder shows a Quick Look preview, which is a still picture of the page: buttons, tabs and charts do not work there.

Open the file in a browser

The address bar then shows a file:/// path. That is normal for a file on your own disk.

  • ✓Drag the file from Finder onto the Safari or Chrome icon in the Dock, or onto an open browser window.
  • ✓In Safari or Chrome, choose File > Open File (Command-O) and pick the .html file.
  • ✓In Finder, Control-click the file, choose Open With, and pick the browser.

Make a browser the default for .html files

Select the file in Finder and choose File > Get Info (Command-I). Under Open with, pick Safari or Chrome, then click Change All. Every .html file now opens in that browser on double-click.

Common snags

  • ✓The file is really called page.html.txt. Finder can hide extensions, and TextEdit adds .txt unless told otherwise. Check the full name under Get Info > Name & Extension and remove the .txt.
  • ✓You saved code from TextEdit and the browser shows the code as text. TextEdit saves rich text by default. Choose Format > Make Plain Text before saving, or save from a code editor.
  • ✓Images, styles or data are missing. The page refers to files that are not next to it on disk. Keep the folder together, use full https:// addresses, or make the file self-contained.
  • ✓A chart or table stays empty in Safari. Pages that load a JSON or CSV file with fetch() are often blocked when opened from file:///. Chrome blocks this too. Serving the page from a web address fixes it; loading a JSON file in a shared page covers the details.

Send it to someone else as a link

Opening the file on your Mac only helps you. Attach the same file to an email or a chat and the other person often gets a download, a preview without scripts, or a blocked attachment. A hosted page opens at an https:// address on any Mac, PC or phone.

With FileShare Pro: upload the .html file from the dashboard, copy the link and send that. The person opening it needs no account.

If an AI tool made the file

Claude artifacts and ChatGPT canvases are usually downloaded as a single .html file. See downloading a Claude artifact and sharing a ChatGPT canvas. Sign up free to share your first page.

Related: opening an HTML file in Chrome, on iPhone and on Android.

Frequently asked

Why does my HTML file open in TextEdit or Xcode instead of Safari?

Another app has become the default for .html files. Select the file, press Command-I, choose Safari or Chrome under Open with, and click Change All.

How do I open an HTML file in Safari on a Mac?

In Safari choose File > Open File (Command-O) and pick the file, or drag the file onto the Safari icon in the Dock.

Why does the page look broken when I open it from my Mac?

It loads from file:/// and cannot reach images, styles or data files that are not beside it, and browsers block some data loading from local files. Keep the folder together or host the page at a web address.

How do I share an HTML file from my Mac?

Upload it to a host and send the link. Attachments often arrive as downloads or previews without scripts; a link opens as a working page on any device.

Got a page to share?

Drop the file, copy the link — live in seconds, free plan included.

Start sharing free