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.
| Browser | Windows or Linux | Mac |
|---|---|---|
| Chrome | Ctrl+U | Command+Option+U |
| Firefox | Ctrl+U | Command+U |
| Safari | Not available | Turn on Show features for web developers first (Settings, Advanced) |
| Any of the above | Right-click the page, then View Page Source | Right-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
- Lines: 13
- Title: Harbour Bakery | Fresh bread daily
- Meta description: Sourdough, pastries and cakes baked every morning.
- Links: 2
- Images: 1
- Scripts: 1
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
| Method | Shows | Can edit | Best for |
|---|---|---|---|
| View Page Source | The HTML the server sent | No | Checking titles, meta tags and tracking scripts |
| Inspect (developer tools) | The live page after scripts ran | Yes, temporarily | Finding which code draws a button or image |
| view-source: in the address bar (Firefox) | Same as View Page Source | No | Linking 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
- Open the page you want to read and press the shortcut for your browser.
- Use the browser's find (Ctrl+F or Command+F) to jump to what you need, such as <title or og:image.
- To study it more easily, copy everything and paste it into the viewer above.
- To see the page as it looks after scripts run, use Inspect instead.
Tips
- Firefox lets you link to a single line: add #line100 to the end of a view-source: address.
- In Firefox, select some text, right-click and choose View Selection Source to see only that part.
- Pages built with a JavaScript framework often show a nearly empty source. Inspect shows what the scripts built.
- Check your own pages after every redesign: a missing title or description shows up instantly in the source.
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.
Build your site free or see all free tools. On We.Inc you can build your site free, with no card and no trial needed to start. AI building is on paid plans from $19 a month.
More in Guides
- View Transitions API Examples
- Vite vs Next.js: Which One Fits Your Project?
- WCAG 2.2 Checklist: All Level A and AA Criteria
- Web Design Contract Template: Free Checklist + Example
- Web Design Principles, Shown Not Told
- Web Design Proposal Template (Free Download + Filled Example) | How-to Guide
- 20 Web Dev Projects for Beginners (with Starter Code)
- Web Font Loading: font-display, Preload and Subsetting
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App