cd /news/developer-tools/clean-dom-exporter · home › topics › developer-tools › article
[ARTICLE · art-139897] src=gist.github.com ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

Clean DOM Exporter

A developer published a lightweight DevTools console snippet that clones the current document, strips bulky elements such as scripts, styles, SVGs, iframes and noscript tags, and copies the resulting minimal HTML to the clipboard. The tool is aimed at Chrome extension development, LLM prompt engineering, and DOM debugging without markup clutter.

by read1 min views1 publishedSep 25, 2026

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 orCtrl + Shift + I /Cmd + Option + I ).
  2. Go to the Console tab.
  3. Paste the following code and press Enter :
(() => {
  // 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!
── more in #developer-tools 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/clean-dom-exporter] indexed:0 read:1min 2026-09-25 · —