pipr.tools
Pipes
Clean Email Strip formatting from pasted email for clean plain text Clean AI Output Clean plain text from ChatGPT or AI output Decode & Format JWT Decode a JWT and pretty-print header and payload Word Frequency Count word frequency in text

html-encode Escape HTML entities

{ } Encode
Input0 chars
Output0 chars

Examples

Escape HTML for safe display in a web page

Usage
"<div class="alert">5 > 3 & 2 < 4</div>" | html-encode

Escape a code snippet for embedding in a blog post

Usage
"Use <code>console.log("hello")</code> to debug." | html-encode

Escape special characters for an HTML email template

Usage
"Sale: 20% off items > $50 & free shipping!" | html-encode
View source
(input)=>input.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;")