MarkdownV2 escaper for Telegram bots
Telegram's MarkdownV2 parse mode rejects messages with any of
_*[]()~`>#+=-|{}.! outside of valid syntax. Paste your message and
we'll show you the escaped version that will actually send.
Escaped output (paste into Bot API)
Preview (what Telegram will render)
Why MarkdownV2 is finicky
Telegram's original Markdown parser was lenient — extra characters were just
ignored. MarkdownV2 (released 2020) is strict: every character in
_ * [ ] ( ) ~ ` > # + - = | { } . !
must be either part of a valid markup token or escaped with a backslash.
An unescaped one returns
Bad Request: can't parse entities.
Reference — what needs escaping where
| Inside normal text | All of _ * [ ] ( ) ~ ` > # + - = | { } . ! |
Inside `inline code` | Backtick ` and backslash \ only |
Inside ```pre block``` | Backtick ` and backslash \ only |
| Inside link/text-mention URL | Parens ) and backslash \ only |
Common gotchas
- Dots and exclamation marks. Sentences ending in
.or!are 90% of the "MarkdownV2 won't send" tickets. Always escape them. - URLs with parens. Wikipedia-style URLs (
...(disambiguation)) break[text](url). Escape the closing paren inside the URL:\). - Hyphens in numbers / phone formats.
+1-555-1234needs each-escaped. Or switch to HTML parse mode. - Bullet lists with
*. A leading* itemlooks like bold-open. Escape:\* itemor switch to HTML mode. - Tables.
|must be escaped — and Telegram doesn't render tables anyway, so just don't ship them.
Alternative: HTML parse_mode
If MarkdownV2's escaping is fighting you, switch parse_mode to
HTML. You only need to escape < > &,
and tags like <b>, <i>, <code>,
<pre>, <a href="…"> work as expected.
Related tools
Inline Keyboard Builder
Visual builder for reply_markup JSON — URL, callback, web app, switch-inline buttons.
Find Chat ID
Step-by-step guide to retrieve the chat_id for a Telegram bot.
Test Bot Token
Paste a bot token and verify it instantly with getMe.
Error Code Reference
Every Telegram API error explained — FLOOD_WAIT, PEER_ID_INVALID, BUTTON_DATA_INVALID, and the actual fix.