Text Tools

Escape / Unescape HTML

Escape or unescape HTML entities in real-time.

', output: '', copied: false, get placeholder() { return this.mode === 'escape' ? '' : '<script>alert("XSS")</script>'; }, escapeMap: { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }, unescapeMap: { '&': '&', '<': '<', '>': '>', '"': '"', ''': "'", ''': "'", '/': '/', '/': '/' }, convert() { if (!this.inputText) { this.output = ''; return; } if (this.mode === 'escape') { this.output = this.inputText.replace(/[&<>"']/g, c => this.escapeMap[c]); } else { this.output = this.inputText.replace(/&[#\w]+;/g, e => this.unescapeMap[e] || e); } }, copyResult() { navigator.clipboard.writeText(this.output); this.copied = true; setTimeout(() => this.copied = false, 2000); } })); });