This article was co-authored by wikiHow staff writer, Hannah Dillon. Hannah Dillon is a Technology Writer and Editor at wikiHow. She graduated with a B.A. in Journalism from North Dakota State University in 2013 and has since worked in the video game industry as well as a few newspapers. From a young age Hannah has cultivated a love for writing and technology, and hopes to use these passions in tandem to help others in the articles she writes for wikiHow.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
This article has been viewed 1,037,223 times.
Learn more...
This wikiHow guide teaches you how to view the source code of a website, which is the code behind any website (such as HTML, CSS, and JavaScript), on most common browsers, including mobile browsers. Keep reading to learn more.
View Page Source on Any Website
In Chrome, Firefox, and Edge, right-click the web page, then click View source (or Page source, View page source, etc.). In Safari, you'll have to enable developer tools to view source code. On mobile, go to view-page-source.com and enter a URL to see its source code.
Steps
-
Open a web browser on your PC, Mac, or Chromebook. The process for viewing source code on Chrome, Firefox, and Microsoft Edge is the same.
-
Navigate to a webpage. Open the page containing the source code you wish to view.Advertisement
-
Right-click the page. If you're using a Mac computer with a one-button mouse, you can hold down Control and click instead. If you are on a laptop with a trackpad, you can use two fingers to click the page instead. This will create a drop-down menu.
- Don't right-click a link or photo; it must be a blank part of the page. If you right-click an object or link, the wrong menu will appear.
-
Click View page source. The button might also say Page source, View source, or something similar. The option is near the bottom of the contextual menu that pops up. Doing so will display your browser's source code in a new window or at the bottom of the current window.
- You can also use the keyboard shortcut Ctrl+U (PC) or ⌥ Option+⌘ Command+U (Mac) to see the source code of a web page.
-
Open Safari and click the Safari menu. It's on the top-left side of your Mac's menu bar. Doing so opens a drop-down menu.[1]
-
Check the "Show features for web developers" or "Show Develop menu in menu bar" box. You will see one of these options, depending on your version of macOS. Once enabled, you should see a Develop menu appear in your Mac's menu bar when Safari is open.
-
Navigate to a webpage. It should be a page with the source code you wish to view.
-
Click the Develop menu. This menu is to the left of the Window menu in your Mac's menu bar.[3]
-
Click Show Page Source. It's near the bottom of the drop-down menu. Clicking this option will prompt Safari to display the webpage's source code.[4]
- You can also press ⌥ Option+⌘ Command+U to display the source code.
-
Go to https://www.view-page-source.com. While there are some tricks that allow you to view source code in a mobile browser, the easiest and quickest way is to use a website called View Page Source. This site will pull the source code of any URL you give to it and then display that source code for you.
- This will work on Android, iPhone, iPad, or any other mobile phone or tablet browser.
- This website also works on your desktop, if you want to use it instead of the methods above.
-
Enter the URL of the page where you want to view the source code. You can either manually type the URL, or paste it. If you haven't got the URL copied, go to the website and copy the URL now, then return to the View Page Source website and enter it in the URL field.
-
Tap Stylize Code? if desired (optional). This will add colors to the source code that make it easier to read.
-
Tap View Source Code. Scroll down to view the source code for the website.
- If the source code is too hard to read, tap Toggle Wrap above the code block to turn on word wrap, so the lines of code won't extend past the edge of your screen.
-
Navigate to the page you want to view the wiki source code for. This could be any wiki, such as Wikipedia—or even wikiHow!
- This will not show you the actual source code of the webpage, but the markup code used to create the article.
-
Click on the Edit button. Since wikis are sites that can be edited by anyone, any page or article you see on a wiki should have an Edit button. However, you may not see this option on all articles, or you may be required to log in to see it.
-
View the wiki code. Note that this slightly differs from the source code for a web page, since it only shows the content inside the article on that page. However, this is a good way to see how the special wiki-specific coding works within that article.
Community Q&A
-
QuestionThe view source doesn't exist on my Mac, where do I find it?Community AnswerTo be able to view the source code of a webpage under Safari, you first need to enable the Developer menu: Click on Safari menu > Preferences > Advanced. Check "Show Develop menu in menu bar" Close the Preferences window Go to the Develop menu > Show Page Source
-
QuestionHow do I view the source code of an image on a page without seeing the code for the whole page?Community AnswerRight-click on the image and select "Inspect" from the available options.
-
QuestionHow do I create HTML source code for an image that I have on my computer?Community AnswerAdd the image location on your computer to the source code. Make sure the file is available and then run.
Tips
-
While you can't usually view source code on a mobile browser, you can save a Safari bookmark on iPhone or iPad to view mobile Safari source code.Thanks
Warnings
- Be wary of downloading third-party applications that claim to display the source code of a website.Thanks
References
- ↑ https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/Web_Inspector_Tutorial/EnableWebInspector/EnableWebInspector.html
- ↑ https://support.apple.com/guide/safari/use-the-developer-tools-in-the-develop-menu-sfri20948/mac
- ↑ https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/Web_Inspector_Tutorial/EnableWebInspector/EnableWebInspector.html
- ↑ https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/Web_Inspector_Tutorial/EnableWebInspector/EnableWebInspector.html
About This Article
1. Open the website in a browser.
2. Right-click the page.
3. Click View page source or View source.