# Clean DOM Exporter

> Source: <https://gist.github.com/tobfd/87b142ee88bb0468b4a0cb3be3ec0138>
> Published: 2026-09-25 21:15:10+00:00

A lightweight DevTools snippet to extract clean, minimal HTML structure from any live website.

Useful for building Chrome extensions, prompt engineering with Large Language Models (LLMs), or debugging DOM structures without clutter like inline SVGs or scripts.

1. Open DevTools in your browser (`F12` or`Ctrl + Shift + I` /`Cmd + Option + I` ).
2. Go to the **Console** tab.
3. Paste the following code and press **Enter** :

``` js
(() => {
  // Clone current document structure
  const clone = document.documentElement.cloneNode(true);

  // Remove unnecessary bulky tags
  clone.querySelectorAll('script, style, svg, iframe, noscript').forEach(el => el.remove());

  // Copy cleaned HTML directly to clipboard
  copy(clone.outerHTML);
  console.log('Cleaned HTML copied to clipboard!');
})();
```

1. The cleaned HTML is now in your clipboard!
