The fastest ways on desktop (Windows, Mac, Linux)
The universal keyboard route: Ctrl+U on Windows and Linux, Cmd+Option+U on macOS, opens a view-source tab showing the raw HTML the server returned. The mouse route is equally universal: right-click anywhere on the page (avoid right-clicking on an element you care about — more on that below) and choose View Page Source. Both give the identical result: the original document, before any script has touched it.
There is also the URL scheme, which works on every desktop browser: type view-source: directly before the address in the URL bar — for example view-source:https://example.com — and press Enter. This is the method to know on a locked-down machine where right-click is disabled, and it is the same trick that makes Android source viewing possible.
How to view HTML source on Android
Chrome on Android has no View Source menu item, but it supports the view-source: URL scheme. Tap the address bar, type view-source: before the full URL — view-source:https://example.com — and load it. The raw HTML appears as text; pinch-zoom to read it, long-press to select and copy sections.
If you need to do this often, add a keyword bookmarklet or install a lightweight view-source add-on from the Chrome Web Store (available in Android Chrome's extensions menu on newer versions). The URL scheme remains the zero-install method and works in Firefox for Android the same way.
How to view HTML source on iPhone and iPad
Safari on iOS does not support the view-source: scheme, so the practical route is the Share sheet: tap Share, and if you have installed a source-viewer app or Safari extension (several free ones exist), choose it there — the page's HTML opens in a reader. Safari's built-in route without any install is the desktop layout trick: open the page, tap the aA icon in the address bar and choose Request Desktop Website, which sometimes exposes long-press source options in third-party browsers available for iOS.
The zero-friction alternative: open the page on an iPhone, copy its URL, and paste it into an online source viewer on the same device. That fetches the server HTML for you — useful precisely because iOS Safari is the one platform without a native shortcut.
Source vs rendered DOM: the distinction that matters
The view-source tab shows the bytes the server sent. Modern pages rarely render those bytes as-is: JavaScript modifies the document after load, inserting elements, moving nodes, and often building the entire visible page from data. Open view-source on a heavy web app and you may see mostly script tags and an empty root div; open the same page in DevTools and you see hundreds of elements. Both are true — one is the recipe, the other is the meal.
To see the live, post-JavaScript structure, use the browser DevTools instead: F12 (Cmd+Option+I on Mac) opens the Elements panel, where the DOM is shown as it exists right now, and you can right-click any specific element and choose Inspect to jump straight to it. SEO tags, meta descriptions and structured data live in the source (what crawlers fetch first); layout and injected content live in the DOM. Knowing which question you are answering tells you which view to open.
<!-- what view-source shows: -->
<body>
<div id="root"></div> <!-- empty: content is built by JS -->
<script src="/app.bundle.js"></script>
</body>
<!-- what DevTools Elements shows after render: -->
<body>
<div id="root">
<header>…</header> <main>…</main> <!-- hundreds of real nodes -->
</div>
</body>What to do with the source once you can see it
The three highest-value reads: the head section, where title tags, meta descriptions, canonical links, Open Graph tags and structured data live — the entire on-page SEO picture of any page in twenty lines; the HTML structure around a design detail you admire, which is the fastest way to learn how a nav or a card layout is actually put together; and your own pages after deployment, to verify that what you shipped is what the server is serving.
To experiment with what you found, copy it into an HTML editor that renders live: change the tags, adjust the CSS, and see the result in a preview instead of imagining it. That loop — view source, copy, edit, render — is how most self-taught developers actually learned, and it still works. If the snippet includes scripts and styles, a tester that captures console errors will show you why your modified version does or does not behave like the original.
When View Page Source is disabled — and what that means
Some sites suppress right-click with JavaScript, which blocks the mouse route but not the others: Ctrl+U still works, view-source: still works, and DevTools still opens. A site can also serve different HTML to different clients — what you see in view-source is what your browser received, which can differ from another visitor's experience on sites with heavy personalization.
One caution worth stating plainly: source code is copyrighted by its author. Reading it to learn techniques is standard practice; copying markup, styles or scripts wholesale into your own project is not. Learn the pattern, write your own implementation — it also teaches you more.
Questions this guide answers
- how to see html code of a web page
- view html
- view page source
- how to view html source code
- view source shortcut
- html source viewer online
- view source android
- view source iphone
Frequently asked questions
What is the keyboard shortcut to view HTML source?
Ctrl+U on Windows and Linux, Cmd+Option+U on macOS. It works in Chrome, Edge, Firefox and Safari, and opens a view-source tab with the raw HTML the server returned.
How do I view page source on Android?
Chrome on Android supports the view-source: URL scheme: type view-source: before the full URL in the address bar and load it. The raw HTML displays as selectable, copyable text.
Can I view source on iPhone without installing anything?
iOS Safari has no native view-source mode. Without an extension, the practical route is an online source viewer — paste the URL and read the HTML. With a Safari source-viewer extension installed, the option appears in the Share sheet.
Why does view-source look different from what Inspect shows?
View-source shows the original server response; the Elements panel shows the live DOM after JavaScript has run. Static sites look nearly identical in both; JavaScript-heavy apps can look completely different, with the source containing just a root div and script tags.
Does viewing a page's source notify the website?
No. Opening view-source is a purely local operation — the browser shows you the document it already downloaded. No request is made and the site has no way to detect it.
How do I edit the HTML source I just viewed?
Copy it into an editor with a live preview: paste into an HTML editor, change what you need, and press Run to render the result. That is also the safest sandbox for experimenting — the changes happen in your browser only, not on the site you copied from.
Related tools and reading
HTML Editor
Paste the source you copied and edit it with instant preview.
HTML Tester Online
Render the markup and catch console errors in one run.
CSS Editor
Experiment with the styles you found in the source.
React JS Online Compiler
See how JS-rendered pages get built, live in your browser.
Best CodePen Alternatives
Nine playgrounds for testing snippets, compared.
Editor Without Signup
Every tool here works without an account.