How to View Page Source

Press Ctrl+U on Windows or Linux in Chrome and Firefox. On a Mac, Chrome uses Command+Option+U and Firefox uses Command+U. You can also right-click an empty part of the page and choose View Page Source. Safari first needs its developer features switched on in Settings, under Advanced.

View source shortcuts by browser (vendor help pages)
BrowserWindows or LinuxMac
ChromeCtrl+UCommand+Option+U
FirefoxCtrl+UCommand+U
SafariNot availableTurn on Show features for web developers first (Settings, Advanced)
Any of the aboveRight-click the page, then View Page SourceRight-click (or Control-click) the page

Updated

Page source is the HTML file the server sent before any scripts ran. It tells you which title and description a page uses, which tracking tags it loads, and where its images live. That makes it the quickest way to check your own site after an edit, or to see how a page you admire is put together.

Page source viewer

Paste HTML you copied from View Page Source. It stays in your browser; nothing is uploaded or fetched.

Quick read

Numbered source

 1  <!doctype html>
 2  <html lang="en">
 3  <head>
 4    <title>Harbour Bakery | Fresh bread daily</title>
 5    <meta name="description" content="Sourdough, pastries and cakes baked every morning.">
 6    <meta property="og:image" content="https://example.com/loaf.jpg">
 7    <script async src="https://example.com/analytics.js"></script>
 8  </head>
 9  <body>
10    <a href="/menu">Menu</a> <a href="/contact">Contact</a>
11    <img src="/loaf.jpg" alt="Sourdough loaf">
12  </body>
13  </html>

View source, Inspect and view-source: compared

Three ways to read a page's code
MethodShowsCan editBest for
View Page SourceThe HTML the server sentNoChecking titles, meta tags and tracking scripts
Inspect (developer tools)The live page after scripts ranYes, temporarilyFinding which code draws a button or image
view-source: in the address bar (Firefox)Same as View Page SourceNoLinking to a line, like #line100

Handy searches inside page source

Press Ctrl+F (Command+F on Mac) in the source tab and search for these to find the parts that matter most.

What to search for

Each line is something to type into find, followed by what it locates.

<title          the page title in search results
name="description"  the snippet text under the title
og:image        the picture used in link previews
rel="canonical" the address search engines should index
GTM-            a Google Tag Manager container
noindex         a tag that keeps the page out of search

What to look for in your own page source

Near the top, inside <head>, you will find the <title> and <meta name="description">, the text search results show. Further down are og: tags that control link previews on social media, and the scripts for analytics or tag managers.

If a change you made in your site editor does not appear here, the page may be cached. Reload once, then check again.

Reusing what you find

Copyright protects the way something is expressed, not the idea behind it. A layout idea or a common technique is free to use; someone's photos, written copy and illustrations are not, unless their licence says so.

How it works

  1. Open the page you want to read and press the shortcut for your browser.
  2. Use the browser's find (Ctrl+F or Command+F) to jump to what you need, such as <title or og:image.
  3. To study it more easily, copy everything and paste it into the viewer above.
  4. To see the page as it looks after scripts run, use Inspect instead.

Tips

Frequently asked questions

What is the difference between View Page Source and Inspect?

View Page Source shows the original file from the server. Inspect opens the browser's developer tools, where Chrome's docs explain the DOM tree shows the page's current state, which differs from the HTML once JavaScript adds, removes or edits parts of it.

Can I copy HTML code from a website?

You can read and learn from it. Reusing it is another matter: the US Copyright Office says original writing, artwork and photographs on a website may be protected. Copyright does not cover ideas, systems or methods, so learn the technique and write your own version. This is general information, not legal advice.

Why is the view source option missing?

In Safari it stays hidden until you tick Show features for web developers under Settings, Advanced. On a managed work or school computer, an administrator may have switched developer tools off; ask them.

Can I see a website's server code, like PHP or database queries?

No. The server runs that code and sends only the resulting HTML, CSS and JavaScript. Nothing in the page source reveals what produced it.

Related: Why your website says Not secure, How to add Google Tag Manager, On-page SEO checklist, Social media image sizes.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Guides

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap