HTML Text Encoding Toolkit
Convert HTML to a JavaScript string, strip HTML tags, read HTML from the clipboard and turn line breaks into br tags, all in one page.
About This Tool
The HTML text encoding toolkit groups four common tasks on one page: turning an HTML snippet into a JavaScript string literal, stripping HTML tags to plain text, reading HTML source from the clipboard, and converting line breaks into br tags. These tasks are small but frequent enough that hunting for separate tools wastes time.
When stripping tags you can list elements to remove entirely such as script, style and iframe, and optionally keep line breaks so paragraphs do not collapse into one line. Clipboard parsing uses the standard read API and falls back to paste capture when blocked.
Key Features
HTML to JS string
Outputs concatenated string literals or a template literal with proper escaping.
Controllable tag stripping
Choose which tags to remove and whether to keep line breaks.
Clipboard HTML
Read the underlying HTML of content copied from Word or a web page.
Newline to br
Normalises CRLF then replaces breaks, optionally wrapping blocks in p tags.
When to Use It
Embed templates in JS
Convert HTML fragments into string literals for scripts or component config.
Extract plain text
Strip rich text markup to get text for summaries or search indexes.
Inspect pasted content
See which inline styles and tags come along with copied web content.
How to Use It
- 1Pick the tab for the task you need.
- 2Paste HTML or text, or click read clipboard.
- 3Adjust options such as join mode or removed tags.
- 4Click Convert and copy the result.
Frequently Asked Questions
Why does reading the clipboard do nothing?
Clipboard reads require HTTPS and user permission. If blocked, paste directly into the input with Ctrl+V, the result is identical.
Will stripping tags lose text?
Only the tags you specify are removed and their inner text is kept by default. Removing script or style also removes their code.
