Every web page is built from code that your browser reads and turns into the page you see. Looking at that code is called viewing the page source. It is a simple way to check how a page is built, find its title and meta tags, or fix a problem on your own site. This guide shows how to view the source code in the most common browsers and what to look for once you open it.
The source code of a page is the HTML the server sends to your browser. It contains the text of the page, the headings, the links, and references to images, stylesheets, and scripts. Your browser follows those instructions to display the page.
What you see in the source is only what the browser received. Code that runs on the server, such as PHP, and any data stored in a database are not visible, because they never leave the server.
Type view-source: in front of the page address and press Enter. For example:
view-source:https://www.example.com/
This works in most desktop browsers and is handy when the right-click menu is disabled.
If you cannot open the source in your browser, you can use our Get Source Code of Webpage tool. Enter the address of a public page and the tool will fetch its HTML for you.
These two options look similar but show different things.
If a page loads content with JavaScript, you may find it in Inspect but not in the page source.
Look inside the <head> section for the <title> tag and the meta description. These are what search engines often show in results.
Search for <h1>, <h2>, and <h3> to see how the page is structured.
A canonical tag tells search engines which address is the main version of a page. A robots meta tag can ask them not to index it.
You can see every link and image on the page, and check that images have an alt attribute.
The source lists the JavaScript and CSS files the page loads, which can help you spot files that are not needed.
<head> section first, because it holds most of the SEO information.Viewing the source of a public page is normal and allowed. However, the text, images, and code on a site may be protected by copyright. Learn from how a page is built, but do not copy another site's content or code and publish it as your own.
Yes, viewing the HTML your browser receives is a normal part of using the web. Copying and reusing someone else's protected content is a separate matter and may not be allowed.
No. PHP and other server-side code run on the server, and only the resulting HTML is sent to your browser.
Some sites block it. You can still use Ctrl + U or the view-source: address.
You can change what you see on your own screen using developer tools, but this does not change the real website.