How to View the HTML Source Code of a Webpage in Google Chrome

Every beautiful website you visit is ultimately just a text file written in HyperText Markup Language (HTML). Your web browser reads this code and translates it into the layout, images, and text you see on the screen. Whether you are an aspiring web developer trying to figure out how a specific page was built, an SEO specialist checking meta tags, or simply a curious user, Google Chrome makes it incredibly easy to peek behind the curtain and see the raw code that powers the internet.

Google Chrome provides a built-in feature to view the unrendered, raw HTML source code of any webpage you are currently visiting. This view is read-only, meaning you can safely look at the code without accidentally breaking the website.

This guide explains how to view the HTML source code of a webpage in Google Chrome on your desktop computer.

Method 1: Using the Right-Click Context Menu

The easiest and most common way to view a page’s source code is using your mouse.

  1. Open Google Chrome and navigate to the webpage you want to inspect.
  2. Find a blank space on the webpage (avoid clicking directly on an image, a link, or an embedded video).
  3. Right-click on the blank space to open the context menu.
  4. From the menu, click on View page source.

Chrome will immediately open a brand new tab displaying the raw HTML document. The code will be color-coded (syntax highlighted) and numbered down the left side to make it easier to read.

Method 2: Using a Keyboard Shortcut

If you prefer keeping your hands on the keyboard, you can instantly pull up the source code tab using a universal shortcut.

  1. Navigate to the webpage you want to view.
  2. Press the following keys on your keyboard:
    • Windows/Linux: Press Ctrl + U
    • macOS: Press Option + Command + U

A new tab will instantly open with the HTML source code.

Method 3: Using the “view-source” URL Prefix

If you want to quickly navigate directly to the source code of a specific URL without loading the visual page first, you can use a special prefix in the Chrome address bar.

  1. Click into the Chrome address bar (Omnibox) at the top of the browser.
  2. Type view-source: followed immediately by the full URL of the website. Do not put a space between the colon and the URL.
    Example: view-source:https://www.example.com
  3. Press Enter.

Tip: Once you have the source code tab open, you can press Ctrl + F (or Command + F on a Mac) to open a search bar. This allows you to quickly find specific elements in the code, such as the “title” tag or specific keywords.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.