How to view the source code of a webpage in Safari

There are people out there who like to see what’s under the hood of web pages they visit. Whatever your reasons might be for that, there are a few simple steps that allow you to see the HTML source code of a website in Safari for Mac. In this post, we’ll show you how to view the source code of a web page.

View source code of a web page in Safari

How do you view HTML source code in Safari?

The first step to being able to see the HTML code of a site is to enable Develop mode, a mode that Apple hides by default as the company assumes only developers would want to tinker with these options.

Enable Develop mode in Safari

  1. Open Safari and press Command + comma (,) keys, or click Safari > Preferences from the top menu bar.
  2. Go to the Advanced tab.
  3. At the bottom, check the box that says Show Develop menu in menu bar.
Advanced Tab Show Developer Menu Safari

In the menu bar, you will now see a new tab called Develop.

Develop option in Safari menu bar on Mac

Show page source code

Now that you have enabled this developer mode, you can access the source code of a web page in three different ways:

  • With the web page open, go to Develop in the menu bar and select Show Page Source.
  • On the web page for which you want to see the source code, press the Option + Command + U keys simultaneously.
  • This is probably the easiest option. Simply Control-click or right-click on an empty area of the page and select Show Page Source.
Show Page Source using right-click in Safari on Mac

When performing any of these actions, the source code of the page will then appear at the bottom of your Safari window. From there, you can inspect all you want.

Related tips: