Character Escaper โ€” Escape HTML, JSON, SQL & More | Tinker
โ† Tinker

Why Character Escaping Matters

When user-supplied text is embedded into HTML, SQL queries, JSON payloads, or code strings without escaping, special characters can break the surrounding syntax โ€” or worse, be interpreted as executable instructions. This is the root cause of some of the most common and severe security vulnerabilities on the web.

What can go wrong without escaping?

When to use each mode

ModeUse whenCharacters escaped
HTMLInserting text into HTML attributes or element content& < > " '
JSON StringEmbedding a value inside a JSON string literal" \ / and control chars
JavaScriptInjecting a value into a JS string in a template\ ' " \n \r \t
SQLBuilding SQL queries with string parameters (prefer parameterised queries)' \
CSVOutputting fields that contain commas, quotes, or newlinesWraps field in quotes, doubles internal quotes
RegexUsing a dynamic string as a literal pattern in a RegExp constructor. * + ? ^ $ { } ( ) [ ] \ |

Common Escape Sequences at a Glance

CharacterHTMLJSON / JSSQL
&&amp;โ€”โ€”
<&lt;โ€”โ€”
>&gt;โ€”โ€”
"&quot;\"โ€”
'&#39;\'''
\โ€”\\\\
newlineโ€”\nโ€”
tabโ€”\tโ€”

The golden rule

Always escape at the point of output, not at the point of input. Escaping on input corrupts the stored data and means you need to know which format it was escaped for later. Store raw text, escape when rendering.

© 2026, Tinker - tools ยท calculators ยท practice games