String Escape Utilities
Escape and unescape strings for HTML, JavaScript, JSON, SQL, URL, and other formats
Examples
Escape markup as HTML entities
<div class="note">Tom & Jerry's</div><div class="note">Tom & Jerry's</div>Ampersands, angle brackets and both quote styles are replaced in the component's fixed order.
Encode a URL component
café / tea?caf%C3%A9%20%2F%20tea%3FencodeURIComponent converts the UTF-8 text and reserved separators into percent-encoded bytes.
Encode UTF-8 text as Base64
Hello, 世界SGVsbG8sIOS4lueVjA==The component converts the string to UTF-8 bytes before applying Base64 encoding.
About this tool
String Escape Utilities applies ten targeted encoders and decoders to one text input: HTML entities, JavaScript string escapes, JSON string content, SQL quote doubling, URL component encoding, CSV field quoting, XML entities, regular-expression metacharacters, Base64 and four-digit Unicode escapes. Select any combination and copy each result independently.
Escape and Unescape modes use small format-specific transformations. JSON escaping delegates to JSON.stringify, URL mode uses encodeURIComponent and decodeURIComponent, CSV wraps fields containing commas, quotes or newlines, and the Base64 path converts UTF-8 text before calling browser Base64 APIs.
Processing trims the entire input before conversion. The visible Batch mode and Preserve newlines switches are not currently applied by the processing function, and SQL escaping only doubles quotes—it does not parameterize or secure a query.
How to use
Choose a direction
Select Escape to encode special characters or Unescape to reverse one of the supported encodings.
Enter text and formats
Paste text or load a sample, then enable the HTML, JavaScript, JSON, SQL, URL, CSV, XML, Regex, Base64 or Unicode result types you need.
Process the text
Click Escape Text or Unescape Text. The tool trims the outer whitespace and computes both directions for every selected format.
Copy the appropriate result
Review the separate result cards and copy only the encoding required by the destination context.
Use cases
Embedding text in markup
Escape HTML or XML metacharacters before placing literal text into an appropriate text context.
Preparing a URL query value
Percent-encode one component before assembling it into a query string or path segment.
Building test fixtures
Produce JavaScript, JSON, CSV, Unicode or Base64 representations for deterministic parser and API tests.
Escaping a literal regex fragment
Backslash regex metacharacters before inserting user-supplied literal text into a larger expression.
Common mistakes
Mistake:Using SQL quote doubling instead of parameterized queries.
Fix:Bind values through the database driver; use the SQL result only when you specifically need a quoted literal representation.
Mistake:Selecting an encoding that does not match the destination context.
Fix:Choose based on where the text will be inserted—HTML entities, JSON string content and URL components have different rules.
Mistake:Expecting leading or trailing whitespace to survive.
Fix:Account for the component's input.trim() call or use another tool when outer whitespace is significant.
Mistake:Relying on Batch mode or Preserve newlines to change processing.
Fix:Those switches currently do not affect the conversion; inspect the actual result and process lines separately when needed.
Frequently asked questions
References & standards
Related tools
Binary Text Translator
Convert text to binary or hex bytes and decode it back
Case Converter & Text Formatter
Convert text between 14 different case formats including camelCase, snake_case, kebab-case with batch processing and advanced options
Character Frequency Analyzer
Count character, letter and word frequencies for text analysis
Find and Replace Text
Find and replace text with optional regex, case, and multiline matching
HTML to Markdown Converter
Paste HTML and get clean Markdown. Configurable heading style, bullet marker, and code block style — all processed locally in your browser.
Markdown Linter
Check Markdown for common style problems — skipped heading levels, trailing whitespace, hard tabs, missing space after #, trailing heading punctuation, long lines, and stacked blank lines