HTML Formatter & Beautifier - Online HTML Cleaner
Tidy up messy HTML code with our online formatter and beautifier. Indent and clean your markup, preview the output instantly. No data is uploaded, everything runs in your browser.
UD5 Toolkit
Clean dangerous tags, strip malicious attributes, and prevent cross-site scripting attacks instantly.
Waiting for input...
<script>, <iframe>, <object>, and removes event handler attributes such as onclick, onerror, and onload. It also blocks javascript: protocol URLs in links and images.
<script>, <iframe>, <object>, <embed>, <applet>, <form>, <input>, <button>, <select>, <textarea>, <link>, <base>, and <meta>.onclick, onerror, onload, onmouseover, onfocus, onblur, onchange, onsubmit, onkeydown, onkeyup, and over 100+ more on* attributes. The javascript: protocol in href and src attributes is also stripped. In strict mode, style attributes may also be removed to prevent CSS-based injection vectors.
<a> (with safe href), <img> (with safe src), <table>, <ul>, <ol>, <h1>-<h6>, <p>, <strong>, <em>, <blockquote>, <code>, <pre>, and many more. Style attributes are preserved but checked for dangerous content.style attributes, stripping class and id attributes, and only allowing the most basic formatting tags like <b>, <i>, <u>, <p>, <br>, <strong>, <em>, <ul>, <ol>, and <li>. This is ideal for comment systems or fields requiring maximum security.
DOMParser API to parse raw HTML into a structured DOM tree. It then recursively traverses every element node, checking each tag against a whitelist of safe tags and each attribute against a blacklist of dangerous patterns (event handlers, javascript: protocols). Dangerous elements are removed while preserving their text content. The sanitized DOM is then serialized back to clean HTML using innerHTML. All processing happens entirely in your browser β no data is ever sent to any server, ensuring your HTML remains private and secure.
ALLOWED_TAGS and ALLOWED_ATTR configurations give you full flexibility to define your own security policy.
Always combine client-side sanitization with server-side validation. Use Content Security Policy (CSP) headers to restrict which scripts can execute on your site. Set cookies with HttpOnly and Secure flags. Remember: never trust user input β sanitize early, sanitize often.
This is safe content.
\n\n
\nEvent handlers are dangerous.
', 'malicious-link': 'Click me - looks safe but isn\'t!\nThis is a real safe link\nHello World!
\n\n\n
\n\nEnd of profile.
' }; // ββββββββββββββββββββββββββββββββββββββ // Event Handlers // ββββββββββββββββββββββββββββββββββββββ $btnSanitize.on('click', function() { const $btn = $(this); $btn.addClass('disabled').prop('disabled', true); $btn.find('i').removeClass('fa-shield').addClass('fa-spinner fa-spin'); // Small delay for UX feedback setTimeout(() => { performSanitization(); $btn.removeClass('disabled').prop('disabled', false); $btn.find('i').removeClass('fa-spinner fa-spin').addClass('fa-shield'); }, 150); }); $btnClear.on('click', function() { $input.val(''); $outputCode.html('Waiting for input...'); $outputPreview.html('').addClass('d-none'); $outputCode.removeClass('d-none'); $viewCodeRadio.prop('checked', true); $statsRow.fadeOut(200); sanitizeStats = { originalSize: 0, cleanedSize: 0, tagsRemoved: 0, attrsStripped: 0, dangerousTagsFound: [] }; }); $btnCopy.on('click', copyOutput); $viewCodeRadio.on('change', toggleView); $viewPreviewRadio.on('change', toggleView); // Example chips $('.example-chips .chip').on('click', function() { const exampleKey = $(this).data('example'); if (examples[exampleKey]) { $input.val(examples[exampleKey]); // Auto-sanitize on example selection $btnSanitize.trigger('click'); } }); // Keyboard shortcut: Ctrl+Enter to sanitize $input.on('keydown', function(e) { if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') { e.preventDefault(); $btnSanitize.trigger('click'); } }); // Mode switch auto re-sanitize $modeBalanced.on('change', function() { if ($(this).is(':checked') && $input.val().trim()) { $btnSanitize.trigger('click'); } }); $modeStrict.on('change', function() { if ($(this).is(':checked') && $input.val().trim()) { $btnSanitize.trigger('click'); } }); // ββββββββββββββββββββββββββββββββββββββ // Initial State // ββββββββββββββββββββββββββββββββββββββ $statsRow.hide(); $outputPreview.addClass('d-none'); // Load a default example for immediate demonstration const defaultExample = 'Hello World!
\n\n
';
$input.val(defaultExample);
// Auto-run sanitization on page load
setTimeout(() => {
performSanitization();
}, 100);
})();
Tidy up messy HTML code with our online formatter and beautifier. Indent and clean your markup, preview the output instantly. No data is uploaded, everything runs in your browser.
Paste response headers string and get a security audit. Check presence and configuration of key security headers. Local analysis.
Paste CSS with vendor prefixes and get a clean version with only the standard property. Modernize your stylesheets.
Perform simple or regex-based find and replace operations on text. Batch replace words, phrases, or patterns instantly. Processed locally in your browser.
Paste email headers or body text to quickly spot phishing signs, suspicious domains, and obfuscated links. Educational and private.
Strip leading line numbers from code snippets or poetry. Quick and accurate. Restore the original text. Entirely local processing, no data upload.
Simulate an earthquake alarm with a countdown and visual instructions for Drop, Cover, and Hold On.
Browse a searchable list of standard HTTP request and response headers with explanations. Quick dev help.
Quick reference for what to do (and not do) after a snake bite. Pressure immobilization bandage diagram.
Build hreflang tags for multiβlanguage websites. Select languages and URLs and get the complete <link> snippet.
Timer to remind you to limit shower water exposure even with a cast cover. Keep your cast dry.
Upload a WebP image and automatically generate a <picture> tag with JPEG/PNG fallback. Ensure compatibility everywhere.
Calculate the correct series resistor for an LED based on supply voltage, LED forward voltage, and desired current. Circuit diagram shown. Local only.
Set a timer that reminds you to take a break, stretch, or follow the 20β20β20 rule. Desktop notification supported. Runs offline.
Enter your must volume and current Brix, TA, and pH to calculate additions of sugar, acid blend, or tannin. Standard winemaking formulas.
Log your daily water consumption with one click. Set a goal and track progress. Data stored locally for privacy. Simple and clean interface.
See the current UV index forecast or enter a value to learn protection needed (SPF, hat, shade). Educational.
Look up any HTTP status code and see its meaning, RFC reference, and example. Full offline reference.
Set a reminder to change smoke detector batteries every 6 months. Optional sound alert and visual countdown. Local browser notification, stay safe.
Remove silent parts from an audio recording. Useful for podcasts and lectures. Set threshold and minimum silence duration.
Enter any two values (voltage, current, resistance, power) and compute the others. Visual triangle helper and formula display. Instant local calculation.
Convert any text to snake_case, kebabβcase, camelCase, or PascalCase. Essential for programming variable naming. Local.
Explore all Intl APIs: NumberFormat, DateTimeFormat, RelativeTimeFormat, ListFormat. See outputs for any locale. Powerful i18n.
Interactive checklist to build an emergency go-bag. Covers water, food, first aid, tools, documents. Track progress locally. Essential for disaster preparedness.
Enter hiding places and get a set of rhyming clues to print. Fun for kids' parties.
Enter word pattern with ? for unknown letters and known letters to find matching dictionary words. Essential crossword help. Local dictionary.
Set a date when a new fish arrives and get a daily checklist for observation. Countdown to safe introduction.
Set recurring audio/visual reminders to check and correct sitting posture. Adjustable interval and notification style. Helps reduce back pain from desk work.
A complete reference of HTTP status codes with explanations. Search and filter by code or category. Useful for API developers and web debugging. Static and fast.
Create a properly styled 'Skip to Content' link. Customize target and appearance. Essential for keyboard users. Copy the HTML/CSS.