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.
- Open DevTools in your browser (
F12orCtrl + Shift + I/Cmd + Option + I). - Go to the Console tab.
- 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!');
})();
- The cleaned HTML is now in your clipboard!