Markdown escaper
In Use *stars* and _underscores_, each star and underscore gets a backslash, as in \*stars\*, so the words appear exactly as typed instead of turning bold or italic; backticks and brackets are handled the same way. Decoding removes the escapes. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- Use *stars* and _underscores_ with `code`
- Calculation mode
- Encode
- Result
- Use \*stars\* and \_underscores\_ with \`code\`
- Encoding
- markdown
- Input length
- 41
- Output length
- 47
This Markdown escaper converts plain text into a backslash-escaped form so special characters render as ordinary glyphs instead of emphasis, code spans, links, headings, or list markers, and it reverses the same mapping when you paste escaped Markdown back into ordinary characters. Decoding accepts only those known specials after a backslash and fails loudly on incomplete trailing backslashes or unknown escape pairs so typos never silently survive into production. The path is fully deterministic: the same text and mode always produce the same result, with no network calls, no random salts, and no date-dependent shortcuts. Small checks include encoding a line that contains emphasis markers into backslash-star form, and decoding a link-like sequence with escaped brackets back into real punctuation.
What Markdown escaping is and what this tool returns
Markdown treats a small set of ASCII punctuation characters as syntax markers: asterisk and underscore for emphasis, backtick for code, square brackets and parentheses for links and images, hash for headings, plus and hyphen for lists, pipe for tables, angle brackets for autolinks and HTML, tilde for strike-through in many dialects, and backslash itself as the escape introducer. CommonMark and compatible processors allow a preceding backslash to neutralize those specials so the character appears literally in the rendered output.
This page implements that encode set on the encode path and the reverse on decode: the response is the transformed string content only, without wrapping the text in a full document skeleton or converting it to HTML. Unlike a full Markdown parser, this landing does not build an abstract syntax tree, resolve reference links, or evaluate nested blocks; it answers only the special-character escape contract.
Where Markdown escape and unescape fit in developer workflows
Documentation and support teams encode dynamic product names and error codes before placing them inside a Markdown field so a single underscore, backtick, or bracket cannot flip the surrounding emphasis or open a broken link. Pipeline authors decode escape-heavy exports from ticket systems so application code works with true punctuation instead of littered backslash-star sequences. Quality engineers generate deterministic encode and decode pairs for contract tests so a middleware that claims Markdown sanitization cannot silently switch to a non-standard escape table between releases.
Educators use the same tool when teaching the difference between Markdown source, the small set of specials that control rendering, and the backslash rule that restores literal characters.
What you can do with it
Literal Markdown snippets
Escape titles, product names, and user snippets so asterisks, underscores, backticks, and brackets cannot trigger emphasis, code, or links in README and chat Markdown.
FAQ
What does the Markdown escaper cost?
It is free in your browser on this page.
Which characters are escaped on encode?
Encode prefixes backslash, backtick, asterisk, underscore, braces, square brackets, parentheses, hash, plus, hyphen, period, exclamation, pipe, angle brackets, and tilde with a backslash. Other characters are left unchanged.
What happens if an escape is incomplete or illegal?
Lone trailing backslashes and backslash pairs that are not a known Markdown special are rejected.
Is the result deterministic?
Yes. The same text and mode always produce the same result with no network, randomness, or date-dependent behavior.
Does the tool turn Markdown into HTML?
No. It only adds or removes the backslashes in front of special characters and gives you back the text itself. It does not build a page, convert anything to HTML or resolve links, so it fits into any Markdown you already write.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/enc/markdown-escape \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Use *stars* and _underscores_ with `code`"}'const res = await fetch("https://api.kit.forhosting.com/enc/markdown-escape", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "Use *stars* and _underscores_ with `code`"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/markdown-escape",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "Use *stars* and _underscores_ with `code`"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/markdown-escape", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"Use *stars* and _underscores_ with `code`"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"Use *stars* and _underscores_ with `code`"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/markdown-escape", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "Use *stars* and _underscores_ with `code`"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.markdown_escape",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
What Markdown escaping is and what this tool returns
The JSON response always includes result for the transformed string, mode echoing encode or decode, encoding fixed to markdown, and input_length plus output_length so tests can assert sizes. Encode also reports escapes_applied and decode reports escapes_resolved so you can confirm how many special characters or escape sequences were rewritten. There is no partial silent skip for a broken sequence: either every backslash pair is a known Markdown special or the request fails with invalid_input.
How text and mode are read and how results stay reproducible
Encode walks the string by UTF-16 code units and prefixes only the characters in the Markdown special set, leaving letters, digits, spaces, and ordinary Unicode unchanged so readable copy stays readable. Because backslash is itself a special and is rewritten in the same left-to-right pass as asterisks and brackets, you get a single consistent escaping pass that remains invertible by decode. Decode scans for backslash-led sequences and accepts only a following character from the same special set. The preferred payload field is text, with aliases input, value, s, and payload so forms, query strings, and SDK clients can reuse the same contract without renaming columns. Mode defaults to encode and accepts decode explicitly; aliases op, direction, and action map to the same switch for scripts that already use those names, and escape or unescape are accepted as synonyms. An incomplete trailing backslash or a backslash followed by a non-special letter raises invalid_input with a message that names the problem. The length ceiling of one hundred thousand characters keeps Worker memory predictable while still covering README bodies, sample docs, and most paste buffers. Pair the free browser run on this page with the priced API when you need the identical mapping inside an automated pipeline without re-implementing Markdown escape tables yourself. Invalid inputs return invalid_input and are not charged, which keeps validation cheap while successful transforms remain a fixed item price at $0.002.
Where Markdown escape and unescape fit in developer workflows
On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split—free interactive exploration and a priced, identical API—matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the escaped result. Pair it with JSON string escape or URL percent-encoding when you need broader text transforms, and with other encoding endpoints when you are building a small lab of free, deterministic tools for CI and documentation.
Integration use cases
Fixture and export cleanup
Decode backslash-escaped Markdown specials from ticket exports, logs, or golden files back into plain Unicode for readable diffs and application code.
Deterministic CI pairs
Generate reproducible encode and decode pairs for unit tests, contract checks, and middleware that must match CommonMark-style literal escaping.
Technical questions
What modes are supported?
mode=encode (default) turns plain text into backslash-escaped Markdown specials. mode=decode turns those escapes back into characters.