ViewPageSource
Back to Blog
Guides

How to View Page Source on Any Device (Chrome, Safari, Mobile)

A complete guide to viewing website HTML source code on desktop and mobile. Step-by-step instructions for Windows, Mac, Android, and iOS.

ViewPageSource Team May 25, 2026
How to View Page Source on Any Device (Chrome, Safari, Mobile)
View Page Source on Any Device

Inspecting Code in a Mobile-First World

Whether you are a developer debugging a layout, a digital marketer checking tracking codes, or an SEO auditing on-page tags, viewing a website's raw HTML source code is the fastest way to get the ground truth.

However, as devices have evolved, how we view page source has changed. On desktop, a simple keyboard shortcut does the job. But on mobile devices—which now account for over 50% of web traffic—viewing source code can be notoriously difficult.

In this comprehensive guide, we will show you exactly how to inspect page source on every operating system and browser, including Windows, macOS, iOS (iPhone and iPad), and Android.


1. How to View Page Source on Desktop (Windows & Mac)

Desktop browsers make it easy to inspect source code using native keyboard shortcuts or context menus.

Google Chrome & Microsoft Edge Chrome and Edge share the same rendering engine, meaning their shortcuts are identical: - Keyboard Shortcut (Windows/Linux): Press Ctrl + U - Keyboard Shortcut (macOS): Press Cmd + Option + U - Right-Click Method: Right-click on any blank area of the webpage and select View Page Source.

Mozilla Firefox Firefox is built for web development and provides simple access: - Keyboard Shortcut (Windows/Linux): Press Ctrl + U - Keyboard Shortcut (macOS): Press Cmd + U - Right-Click Method: Right-click the page and select View Page Source. Firefox also lets you highlight text, right-click, and choose View Selection Source to see just that block.

Apple Safari (macOS) Safari hides developer tools by default. To enable them: 1. Open Safari Settings (or press Cmd + ,). 2. Go to the Advanced tab. 3. Check the box at the bottom labeled Show features for web developers. 4. Once enabled, press Cmd + Option + U or right-click the page and select Show Page Source.


2. How to View Page Source on Mobile (iPhone & Android)

Mobile browsers do not include a simple "Right-Click > View Source" option. Here is how you can bypass these limitations.

The Prefix Method (Chrome/Firefox/Edge) For most mobile browsers except Safari, you can use the URL prefix trick: 1. Tap the address bar of your browser. 2. Position your cursor at the very beginning of the URL. 3. Type view-source: directly before the address (for example, view-source:https://example.com). 4. Tap Go or Enter. The browser will load the raw HTML code of the page.

The Safari iOS Limitation Safari does not support the view-source: prefix. To view source code in mobile Safari, you must create a complex JavaScript bookmarklet: 1. Bookmark any page. 2. Edit the bookmark, rename it to "View Source", and replace its URL with: javascript:(function(){var w=window.open('about:blank');w.document.write('<pre>'+navigator.userAgent+'\n\n'+document.documentElement.innerHTML.replace(/&/g,'&amp;').replace(/</g,'&lt;')+'</pre>');w.document.close();})() 3. Visit the site you want to inspect, tap your Bookmarks menu, and select your "View Source" bookmarklet. This will load the HTML in a new tab.


Ready to optimize your site?

Skip the bookmarklets and prefixes. Inspect any URL instantly on mobile using our free page tool → Use our free Page Source Viewer


3. The Ultimate Cross-Device Solution: Online Viewers

If you find keyboard shortcuts, prefixes, or custom JavaScript bookmarklets tedious, the easiest option is to use an online source code viewer.

By pasting any URL into ViewPageSource.online, you can immediately inspect the website's code on any device without installing extensions or coding custom bookmarks. Our tool does more than display the raw code—it formats it cleanly, separates CSS and JavaScript into dedicated tabs, and lets you toggle line wrapping or copy code blocks with one tap. This is especially helpful for auditing sites on mobile phones where browser text select is clumsy.


Frequently Asked Questions

Can I inspect a website's source code on Safari on iPhone? Yes, but since Safari lacks native source viewing, you must either write a custom JavaScript bookmarklet, use a third-party developer utility app, or paste the URL into our free online page source viewer.

What is the shortcut to view page source in Chrome? On Windows, press Ctrl + U. On macOS, press Cmd + Option + U.

Is it legal to look at a website's source code? Yes, viewing source code is legal because the HTML, CSS, and JavaScript are public files sent to your browser to render the page. However, you cannot legally copy design assets or code patterns for commercial use.

HR

About the Creator: Hassan

WordPress Developer | 2 Years Experience

Hassan is the lead developer and visionary behind ViewPageSource. As a Computer Science student and WordPress specialist with 2 years of experience in custom theme and plugin development, he built this tool to bring transparency to the web. Hassan focuses on creating high-performance, developer-centric applications that help others understand and audit the technology stacks behind their favorite websites.

View PortfolioWork with Hassan →

Ready to optimize your site?

Use our professional tools to analyze your source code and technical SEO health in seconds.

Start for Free →