Remove HTML attribute

Remove selected HTML attributes while preserving tags, text, and remaining semantics.

freeworks offlinenothing uploaded
ToolHTML Attribute Remover
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Start tags are parsed and attributes are removed by exact name, prefix, or allowlist while element names and text are serialized. Script, style, and text-node content are not treated as attributes.

  • Named removal is safer than stripping whole elements.
  • Allowlists support privacy cleanup.

Worked example

Sanitize pasted HTML content
Remove inline styles and event handlers from HTML copied from a webpage
Input
											<div style="color:red" onclick="alert(1)"><p style="font-size:14px">Hello</p></div>
										
Output
												<div><p>Hello</p></div>
											

When to use this

Scrapers, sanitizers, and migrations remove tracking or obsolete attributes.

Edge cases

  • onclick contains executable text and should be removed by exact name.
  • data-* may hold meaningful app state.
  • Boolean attribute presence is meaningful without a value.

References