How to View the Source Code of a Web Page GA S REGULAR Menu Lifewire Tech for Humans Newsletter! Search Close GO Internet, Networking, & Security > Browsers
How to View the Source Code of a Web Page
View a web page's source code to diagnose errors
By Scott Orgera Scott Orgera Writer Scott Orgera is a former Lifewire writer covering tech since 2007. He has 25+ years' experience as a programmer and QA leader, and holds several Microsoft certifications including MCSE, MCP+I, and MOUS. He is also A+ certified. lifewire's editorial guidelines Updated on December 27, 2021 Tweet Share Email Tweet Share Email Browsers Chrome Safari Firefox Microsoft What to Know
On most major browsers, you can access a site's source code by pressing Ctrl+U in Windows.On a Mac, press Cmd+Option+U within most major browsers or Cmd+U in Firefox.On Android, use the view-source: URL tweak to view source code. On Safari for iOS, this isn't supported. Although web browsers interpret the Hypertext Markup Language files and Cascading Style Sheets that make the web appear as it does, a hotkey or URL tweak forces browsers to display the source code of that page in a new tab or window. Although most people rarely need to examine the source code, developers use this perspective to troubleshoot layout inconsistencies or to fix bugs on a website. How to View Source in a Desktop Browser
For all the major desktop browsers—Google Chrome, Microsoft Edge, Mozilla Firefox, Opera, Vivaldi—press Ctrl+U to open a new tab that displays the raw HTML of the page you're on. On a Mac, press Cmd+Option+U or Cmd+U in Firefox. How to View the HTML Source in Google Chrome Alternatively, all desktop browsers support a URL-specific tweak. Prepend the text view-source: to the URL to open the page in Source mode. For example, type view-source:https://www.lifewire.com to view the source code behind Lifewire's main landing page. Prefer a mouse, or need to tweak the HTML on the fly? All the main browsers support a View Source command somewhere within its menu structure, and they also support a developer mode (named various things, and launched various ways) that permits real-time tweaking to how a page executes based on changes you make in the developer interface. How to View Source on a Default Mobile Browser
The stock Android browser allows the view-source: URL tweak. On iOS, however, the stock Safari app does not support this feature. On Apple's platform, you'll need to launch a different browser or a source-code viewing app from the App Store. Individual mobile browsers that you installed from your platform's app store behave differently. Consult the browser's documentation for specific procedures. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Subscribe Tell us why! Other Not enough details Hard to understand Submit More from Lifewire How to View the HTML Source in Google Chrome How to Save Web Pages in the Opera Desktop Browser Viewing the HTML Source Code in Safari How to Activate the iPhone Debug Console or Web Inspector How to View the Source of a Message in Gmail How to View the Source of a Message in Apple Mail What Is a Web Browser? How to Insert Source Code Into a Word Document How to View the Source of a Message in Mozilla Thunderbird How to Activate and Use Responsive Design Mode in Safari How to View Blurred Text on Websites How to View Full Message Headers in Mozilla Thunderbird ASPX File (What It Is and How to Open One) 9 Best Free HTML Editors for Windows for 2022 Search History: How to View or Delete It How to Modify Text Size in Internet Explorer Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookies Settings Accept All Cookies