Code Tools

Attribute Cleaner

All tools

Strip inline styles, classes, event handlers and any attributes you name from a block of HTML.

How it works

Four simple steps

1

Paste the fragment

Add the HTML copied from Word, Docs or an old page.

2

Pick what to strip

Keep or untick style, class and on* handlers.

3

Name extra attributes

List more names like id, data-* or width in Also remove.

4

Press Run

Clean the markup, then copy or download the result.

Attribute Cleaner

About Attribute Cleaner

Content copied from Word, Google Docs or an old site arrives wrapped in inline styles, generated class names and leftover onclick handlers. Before it goes into your CMS, you want clean tags that inherit your own stylesheet.

Three checkboxes, all on by default, remove style attributes, class attributes and inline event handlers (any attribute whose name starts with on, such as onclick or onload). The Also remove field takes extra attribute names separated by commas or spaces; end a name with * to match a prefix, so data-* removes every data attribute and aria-* every ARIA attribute. Press Run (or Sample) to clean the HTML, then copy or download the result.

The tool runs when you press Run, not as you type, so press it again after changing a checkbox. The HTML is parsed into a document and the contents of body are returned, which means a full page loses its doctype, html and head wrapper; clean fragments rather than whole files. Think twice before removing aria-* attributes, since they often carry accessibility information. Afterwards, compact the cleaned markup or lay it out with the HTML pretty printer. If you only need the words, convert the HTML to plain text instead.

Cleaning happens on a parsed copy in the page. Inline scripts in your paste are not executed, and the markup is not uploaded.

Keyboard shortcut

Ctrl Enter - Run tool
FAQ

Frequently asked questions

See all FAQs

Answers for this tool. For site-wide help, open the FAQ hub.

Yes. Untick class, leave style checked, and press Run. Each checkbox works independently.

Type data-* in the Also remove field. Any attribute that begins with the text before the asterisk is removed from every element.

No. It removes attributes, not elements. Empty spans stay in place, although without their style or class they no longer affect the layout.

View more FAQs

Related tools

View all

HTML Formatter

Beautify and indent HTML markup.

Open

CSS Formatter

Format and pretty-print CSS.

Open

JS Formatter

Beautify JavaScript code.

Open

JSON Formatter

Beautify and validate JSON.

Open

Explore 321 free tools

Everything you need as a developer, marketer or creator - in one beautiful place.

Browse all tools