This wikiHow teaches you how to locate and copy the HTML source code of a website on your computer, phone, or tablet. The steps are pretty straight-forward when you're using a computer or an Android, but if you're using an iPhone or iPad, you'll need a third-party app like View Source to get the job done.
Quick Steps
- Right-click a blank area of the website.
- Click Choose page source .
- Highlight all the text.
- Hit Ctrl + C (PC) or ⌘ Cmd + C (Mac) to copy the code.
Steps
-
Go to the website you want to copy. You can use any web browser on your PC or Mac to view and copy a website's source code.
-
Enable the Develop menu (if you're using Safari). If you're using Safari on a Mac, you'll need to enable the Develop menu if you want to view a website's source code. [1] X Research source This is only required on Safari, so you can skip this if you're using any other browser:
- Click the Safari menu at the top of the screen.
- Click Preferences on the menu.
- Click Advanced .
- Select Show Develop menu in menu bar .
Advertisement -
Right-click a blank area of the website. A context menu will expand.
-
Click View page source on the menu. The phrasing may vary slightly on different web browsers, but this option will always display the current page's source code. [2] X Research source
- If you right-clicked in a frame, you'll see View Frame Source instead. [3] X Research source This will only display the source code of the current frame.
- If you see a link to a file with a name like style.css near the top of the source code, this is a separate file that contains the styles (fonts, colors, layout info) for the website. [4] X Research source Click the link to open that page. If you want to copy all of the code for the site, you'll also need to copy this page.
-
Press Ctrl + A (PC) or ⌘ Cmd + A (Mac). This highlights all of the code on the page. [5] X Research source
-
Press Ctrl + C (PC) or ⌘ Cmd + C (Mac). Now the selected source code is pasted to your clipboard. [6] X Research source
- To paste it into the desired location, right-click and select Paste .
-
Open Chrome or Samsung Internet on your phone or tablet. You can use Google Chrome to view the source code of a website on your Android. [7] X Research source
-
Go to the website you want to view. Wait for the site to load fully before you continue.
-
Tap the address bar. This displays the address of the website.
-
Add view-source: to the beginning of the URL. To do this, just move the cursor to the beginning of the URL (before the https://) and type view-source: .
- For example, if you were going to view the source of wikiHow.com, the URL would look like this: view-source: https://www.wikihow.com
-
Tap the search, enter, or go key to go to the site. This refreshes the site and displays only its source code.
- If you see a link to a file with a name like style.css near the top of the source code, this is a separate file that contains the styles settings (colors, fonts, design, etc.) for the website. Tap the link to open that page. If you want to copy all of the code for the site, you'll also need to copy this page.
-
Tap and hold any word in the source code. This highlights that word and surrounds it by bounding handles.
-
Drag the bounding handles to select all of the source code. To do this, drag the leftmost bounding handle all the way to the beginning of the page, and the rightmost handle all the way to the end. A small toolbar will appear once you're finished.
-
Tap Copy on the toolbar. Now that you've copied the source code, you can paste it anywhere, such as into Google Docs or your note-taking app.
- To paste the code into a file or app, tap and hold the typing area and select Paste .
-
Install View Source from the App Store . There's no setting in any iPhone or iPad web browser that lets you view a website's source code easily. Fortunately, there's an app for that! View Source is a small, easy-to-use app that lets you view and copy the source code of any website.
-
Open Safari (or your preferred web browser). You can still use your regular browser to load the website you want to view.
-
Copy the URL. Once you're on the page you want to view, tap the address bar at the top of the screen to select the URL. Then, tap it again to bring open the context menu and select Copy .
-
Open the View Source app. It's the purple icon with a black window, two brackets, and a semicolon. You'll find it on your home screen and/or your app library.
-
Tap the address bar and select Paste . This pastes the copied URL into the address bar in View Source.
-
Tap the go key on the keyboard. This displays the source code for the URL you entered.
-
Tap and hold any word in the source code. This highlights that word and surrounds it by bounding handles.
-
Drag the bounding handles to select all of the source code. To do this, drag the leftmost bounding handle all the way to the beginning of the page, and the rightmost handle all the way to the end. A small toolbar will appear once you're finished.
-
Tap Copy on the menu. If it doesn't pop up on its own, tap and hold the highlighted area so it appears, and then select Copy . Once the source code is copied to the clipboard, you can paste it into any app you want, such as the Notes app or an email message.
- To paste, tap and hold a typing area and select Paste . [8] X Research source
Expert Q&A
Video
<form action="/contact" method="post"> <label for="name">Name:</label> <input type="text" id="name" name="name" required> <label for="email">Email:</label> <input type="email" id="email" name="email" required> <label for="message">Message:</label> <textarea id="message" name="message" rows="4" required></textarea> <input type="submit" value="Send">
Tips
References
- ↑ https://support.apple.com/guide/safari/use-the-developer-tools-in-the-develop-menu-sfri20948/mac
- ↑ https://support.google.com/surveys/answer/6172725?hl=en
- ↑ https://www.webnots.com/view-webpage-source-css-in-google-chrome/
- ↑ https://www.tutsandtips.com/html/copy-all-html-source-code-with-inspect-in-chrome/
- ↑ https://support.apple.com/en-us/102553
- ↑ https://support.apple.com/en-us/102553
- ↑ https://www.view-page-source.com/howto-see-html-code-different-browsers/
- ↑ https://support.apple.com/guide/iphone/select-and-edit-text-iph1a9cae52c/ios
About This Article
1. Go to the website in a web browser.
2. If you're using Safari on a Mac, enable the Develop menu.
3. Right-click a blank area of the page.
4. Click View page source
.
5. Highlight everything on the page.
6. Right-click the selection and click Copy
.