How to Copy HTML Code From Website

Rajeev Baniya Feb 02, 2024
  1. Use the Edit As HTML Option While Inspecting to Copy the HTML Code
  2. Use the Copy Option While Inspecting to Copy the HTML Code
  3. Use the View page source Option on a Website to Copy the HTML Code
How to Copy HTML Code From Website

The article will introduce methods to copy HTML code from a website using Google Chrome’s Inspect Element.

Use the Edit As HTML Option While Inspecting to Copy the HTML Code

Modern web browsers have an inspect feature that allows users or developers to see HTML contents and styles used in the website. We can also copy HTML contents or manipulate HTML contents to see the outcome in the browser.

However, in this method, we cannot directly copy the code that could be seen while inspecting a webpage. There are some steps to copy the code.

For example, right-click on a website, and then you can see some options. At the end of the options, you will see Inspect.

Click on the Inspect option or use the shortcut, Ctrl+Shift+i. Then, the Inspect tool opens at the bottom or at the right side of the screen.

After inspecting, we can see HTML code on the left side of the inspecting tool in the Inspector tab. Then right-click on <html> and select edit as HTML.

Or, choose the top-level element that you want to copy. Then copy the needed HTML contents of the website.

Use the Copy Option While Inspecting to Copy the HTML Code

We can also copy certain HTML contents directly from inspecting without going through the Edit As HTML option.

After inspecting a website, we can see HTML contents on the left side in the Inspector tab. Then we can right-click on the element to be copied and choose the Copy element option.

This will copy the entire HTML code inside of that container or section.

If we want to copy the entire code, then we can right-click on <html> and go to copy and choose the Copy element option.

Use the View page source Option on a Website to Copy the HTML Code

We can see all the HTML contents used to create a website inside the View page source option. If we right-click on a website, an option pops up.

We can see the View page source option at the end of the option. When we click the option, another tab will open containing all the website’s HTML code.

Then we can select and copy the HTML code.

These are the various methods of copying the HTML code.