THE PRACTICAL GUIDE · NORMANDIN SYSTEMS
Get more from HTML cleaner
HTML Cleaner removes many presentation and unsafe elements from pasted markup, then formats the remaining HTML for reading. This implementation uses a restrictive sanitizer configuration: it allows a small set of attributes including href, src, width, height, alt, colspan, and rowspan, while removing form and span tags and excluding data and ARIA attributes. Review the output because these choices can remove useful semantics. Code transformations are most useful when you know the language and the surrounding context of the snippet. Work from a saved copy and start with a small, valid example that demonstrates the behavior you need. Formatting, encoding, and generation do not establish that a program is correct. Review the output as source code, keep meaningful comments when appropriate, and test the result in the same environment that will eventually interpret it. This makes subtle changes much easier to spot.
Guide updated October 13, 2026
How to use this tool
- Paste a small, representative snippet and keep a copy of the input. Include the punctuation and delimiters needed to make the example meaningful.
- Paste the HTML or supported clipboard markup, inspect the cleaned result, and compare retained elements and attributes with the source.
- Review the example below and compare its expected behavior with a small sample of your own input before continuing.
- Copy the result into a scratch file and verify it with the intended parser, editor, or test environment before replacing the original code.
SEE IT IN PRACTICE
A worked example
<p class="note" style="color:red">Hello</p>
<p>Hello</p>
The text and paragraph remain, while class and style attributes are outside the allowed attribute list.
This cleaner has a deliberately narrow attribute list
The implementation retains attributes such as href, src, width, height, alt, colspan, and rowspan while discarding many others. It also excludes form and span tags and does not retain data or ARIA attributes. That is useful for stripping rich-text presentation, but it can remove application hooks and accessibility information that a normal page needs. Compare the cleaned markup with the intended use rather than assuming every removed attribute was unnecessary.
Sanitization policy belongs to the destination
A sanitizer configuration is a policy choice, not a universal definition of good HTML. A publishing workflow may want simple paragraphs and links, while an interactive application may require carefully controlled classes, roles, or other attributes. Use this output when its restrictions fit the task and review the result visually and semantically. Do not replace a server-side or application-specific security policy with an ad-hoc cleanup step. The formatter makes the remaining source readable, but readability and suitability are separate checks.
When this tool is useful
- Remove imported rich-text styling
- Inspect a simplified HTML fragment
- Prepare markup for a restrictive content workflow
Tips for a better result
- Check links, images, table structure, accessibility needs, and any attributes the destination application relies on before using the result.
- Separate a syntax check from a behavior check. A snippet can parse successfully while producing the wrong value, selecting the wrong element, or changing an important edge case.
- Keep the source and the settings used for this result together. That makes a later comparison or correction easier, especially when another person needs to reproduce the same outcome.
Frequently asked questions
Can cleaning remove accessibility attributes and application hooks?
Cleaning can remove accessibility attributes and application hooks as well as unwanted formatting. It is not a drop-in sanitization policy for every website.
Can I use generated or transformed code immediately?
Treat the result as a draft to review. Check names, escaping, syntax, and assumptions in the target environment, then run a representative test. The tool cannot see the wider application or know every requirement that applies to it.
How do I investigate unexpected output?
Reduce the input to the smallest example that still shows the issue. Check the chosen language or mode, inspect special characters and whitespace, and compare with the original. Add complexity back gradually after the basic example works.
What happens to the information I enter?
The utility processes your input in this browser. Some tools retain field values in browser storage or the URL; avoid entering secrets in shareable fields. Page and asset requests still go to the hosting provider. Read the privacy and offline-use notes for details.