Raw HTML is the source code of a web page as the server delivers it in the HTTP response, before a browser or crawler has run any JavaScript. It is also called the page source or initial HTML. The related term “source code” has a broader meaning in programming, but in SEO it usually points to this document.
What is the difference between raw and rendered HTML?
A browser reads the raw HTML and builds the DOM from it. If the page then runs JavaScript, the content can change. The state after scripts have run is the rendered HTML. The Firefox documentation puts it this way. View Source shows the original HTML as sent by the server, while the Inspector shows the live DOM including all dynamic changes.
For SEO the difference matters because crawlers handle the two versions differently. Google fetches the raw HTML, renders the page later in a headless Chromium and works with the rendered result. Google also states that not all bots can run JavaScript. Titles, canonical tags, links and important text that sit in the raw HTML are readable by every crawler. Anything that only JavaScript adds depends on a successful rendering.
How to view both versions
- Raw HTML. Use “View page source” in the browser, the
view-source:prefix in the address bar on desktop, or a request withcurl. - Rendered HTML. Use the Elements panel in developer tools, or the URL Inspection tool in Search Console, where Google recommends checking that rendered HTML contains the expected content.
Example
curl -s https://example.com/product | grep -i "<h1"
If the command returns no <h1> line but the browser shows a heading, JavaScript creates that heading. It is then missing from the raw HTML and only present in the rendered version.
Common mistakes
- Adding important elements only with JavaScript: Not every bot runs JavaScript. Content, links, titles and canonical annotations in the raw HTML are readable for every crawler.
- Links without
href: Google discovers links only when they are<a>elements with anhrefattribute. - Conflicting canonical annotation: If JavaScript sets a canonical URL, it must match the value in the raw HTML.
FAQ
How do I see the source code of a web page? Open the browser’s context menu and choose “View page source”, or use view-source: in front of the URL.
Why does view source not work on my phone? Mobile versions of Chrome do not offer the view-source: command, according to tools that exist to fill this gap.
More on the searchVIU blog
Sources
- View Source – Firefox Source Docsfirefox-source-docs.mozilla.org
- Introduction to the DOM – MDN Web Docsdeveloper.mozilla.org
- JavaScript SEO basics – Google Search Centraldevelopers.google.com
- Fix search-related JavaScript problems – Google Search Centraldevelopers.google.com
Last updated: