To copy the HTML code from an inspect element, first, you must select the element. After this, click on the Inspect option. This step opens DevTools. Here, find and click on Sources. You will then generally see the HTML code appear. Select the code and copy and paste into a text editor. Additionally, save this file with a .html extension.