Escape and unescape text
Escape or unescape text for HTML, URLs, JSON strings, shell commands, regular expressions and CSV fields.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/escape-unescape \
-H 'Content-Type: application/json' \
-d '{"input":{"text":"<a href=\"x\">Tom & Jerry</a>","format":"html"}}'
import json, urllib.request
body = {'input': {'text': '<a href="x">Tom & Jerry</a>', 'format': 'html'}}
request = urllib.request.Request("https://setget.net/v1/tools/escape-unescape", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/escape-unescape", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"text":"<a href=\"x\">Tom & Jerry</a>","format":"html"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "escape-unescape",
"input": {
"text": "<a href=\"x\">Tom & Jerry</a>",
"format": "html"
}
}
{
"input": {
"text": "<a href=\"x\">Tom & Jerry</a>",
"format": "html"
}
}
Endpoint: POST /v1/tools/escape-unescape. Over MCP: run_tool with slug: "escape-unescape".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
text |
string | yes | The text to escape or unescape. |
format |
string | yes | What the text is being prepared for. One of: html, url, json, shell, regex, csv. |
direction |
string | no | Escape plain text, or turn escaped text back into plain text. One of: escape, unescape. Default: "escape". |
Examples
Input
{
"text": "<a href=\"x\">Tom & Jerry</a>",
"format": "html"
}Result
{
"text": "<a href="x">Tom & Jerry</a>"
}Decoding a URL
Input
{
"text": "caf%C3%A9%20au%20lait",
"format": "url",
"direction": "unescape"
}Result
{
"text": "café au lait"
}Quoting for a POSIX shell
Input
{
"text": "it's here",
"format": "shell"
}Result
{
"text": "'it'\"'\"'s here'"
}A JSON string literal
Input
{
"text": "Line 1\nSay \"hi\"",
"format": "json"
}Result
{
"text": "\"Line 1\\nSay \\\"hi\\\"\""
}Questions
- Which shells does the shell format suit?
- POSIX shells such as sh, bash and zsh. It is not correct for Windows cmd or PowerShell.
- Does URL unescape turn "+" into a space?
- No. "+" only means a space in form data. Here it stays a plus sign; "%20" becomes a space.
- Does JSON escape include the surrounding quotes?
- Yes, the result is a complete JSON string. Unescape accepts the text with or without them.
- What does shell unescape return for several words?
- The words are returned separately in "words", and joined by single spaces in "text".
Related tools
- URL encoder and decoderPercent-encode text for use in a URL, or decode it. Works on one value or a whole URL.
url-encode - HTML entity encoder and decoderEscape text as HTML entities, named or numeric, or decode entities back to characters.
html-entities - Unicode inspectorList every character in a text with its code point, name, category and UTF-8 bytes, flagging invisible ones.
unicode-inspect - JSON formatterPretty-print JSON with your choice of indentation, optionally sorting keys.
json-format - Apply a patchApply a unified diff to a text and get the patched result, with clear errors when a hunk does not fit.
patch-apply - Case converterConvert text between lower, UPPER, Title, Sentence, camelCase, PascalCase, snake_case, kebab-case and more.
case-convert