Copying Code from Inspect Element in Google Chrome

I'm currently developing a website in HTML and I want to copy some of the code from other websites. However when I go into the inspect element feature and try to copy just part of the code it ends up copying the whole script. Is there any way I can get just part of the code from inspect element without having to copy the whole thing and cut out the bits that I don't want in dreamweaver?

asked Sep 25, 2012 at 4:32 422 1 1 gold badge 5 5 silver badges 8 8 bronze badges Try double click, also see Resources panel. Commented Sep 25, 2012 at 4:34 How bout if wanted to copy just a few lines? Commented Sep 25, 2012 at 4:37

Then you would use Resources panel, Scripts panel or at Elements panel select tag and RMB => Edit as HTML => select and copy what you want.

Commented Sep 25, 2012 at 4:48

8 Answers 8

Right click on the particular element (e.g. div , table , td ) and select the copy as html.

13.8k 14 14 gold badges 68 68 silver badges 96 96 bronze badges answered Sep 25, 2012 at 4:41 1,662 10 10 gold badges 40 40 silver badges 66 66 bronze badges

I don't have a Copy as HTML option, but I did find an Edit as HTML option which I could then Ctrl+A to select all and then copy and paste. Great tip!

Commented Feb 12, 2015 at 16:22

Note that this will not save the content of iframes! To copy the content of iframes you'll have to do the above for each element separately.

Commented Jun 16, 2015 at 7:53 You can also just highlight the element and hit ctrl+c on your keyboard. Commented Jun 16, 2015 at 7:55 I only have "Copy" -> "Copy outerHtml". It works as well, thank you. Commented Jul 30, 2019 at 10:52 The Copy element didn't work for me. Choosing Edit as HTML then copying the text box works for me! Commented Mar 5, 2020 at 4:03

In earlier versions of Chrome we could simply select and copy an element (with Ctrl+C or Cmd+C) and then paste it inside an element by selecting it and then paste (with Ctrl+V or Cmd+V). It's not possible in the latest versions though (I'm running Chrome 58.0.3029.110) and it has set me up many times since then.

Instead of using the commands for copy and paste, we now have to right click the element -> Copy -> Copy Element and then right click the element that we want to append the copied element to -> Copy -> Paste Element.

I don't understand why the short commands are deactivated but at least it's still possible to do it in a more inconvenient way.

answered May 17, 2017 at 11:51 1,455 17 17 silver badges 27 27 bronze badges

Click on the line or element you want to copy. Copy to clipboard. Paste.

The only tricky thing is if you click on a line, you get everything that line includes if it was folded. For example if you click on a div, and copy, you get everything that the div includes.

You can also get only what you want by Right Clicking, and select 'Edit as HTML'. This will make that section essentially text, with none of the folding activated. You can then select, copy and paste the relevant bits.