Telegram MarkdownV2 Escaper
Stop Telegram rejecting your formatted messages.
115 characters
- Sent unescaped, Telegram would reject this with "can't parse entities". Reserved characters found: . ( ) ! - [ ]
_*[]()~`>#+-=|{}.!Building a bot that sells access to a Telegram channel? See how MemberPilot handles paid access.
Why Telegram rejects your formatted messages
Telegram validates formatting before it delivers anything. If you set parse_mode to MarkdownV2 and the text contains a reserved character that is not escaped, the Bot API answers 400 Bad Request: can’t parse entities and the message is never sent. It does not fall back to plain text.
This catches people out because the reserved set includes characters that appear in ordinary writing: the full stop, the hyphen, the exclamation mark, the equals sign, and both kinds of bracket. A price list, a date, or a sentence ending in a full stop is enough to fail the request.
The rule, in full
In ordinary message text, all eighteen of _ * [ ] ( ) ~ ` > # + - = | { } . ! must be preceded by a backslash. That applies inside entities too: escaping stops only where the parser stops looking for markup.
Inside pre and code, Telegram escapes only ` and \. Inside the (...) of an inline link or a custom emoji, only ) and \. The output above uses the strict rule, which is valid everywhere.
A practical habit
HTML as the alternative
Telegram’s HTML mode supports the same entities with a much smaller escaping burden: &, < and >. Only the tags the Bot API documents are accepted, and unknown tags are an error rather than being ignored. Switch the toggle above to escape for HTML instead.
If a message fails and you cannot see why, the fastest diagnosis is to drop parse_mode entirely. If it sends, the problem is formatting; if it still fails, the error decoder will name what else Telegram objected to.
Common questions
Which characters need escaping in Telegram MarkdownV2?
Eighteen of them: _ * [ ] ( ) ~ ` > # + - = | { } . and !. Telegram requires a backslash before each one anywhere in the message, including inside bold or italic text and inside ordinary prose. A single unescaped full stop is enough to make sendMessage fail.
Why does Telegram return "can't parse entities"?
Because the text you sent is not valid for the parse_mode you set. Telegram validates formatting before it sends anything, so an unescaped reserved character or an unclosed entity fails the whole request rather than being sent as plain text.
Should I use MarkdownV2 or HTML?
HTML is easier to generate safely, because only three characters — &, < and > — need escaping, and unclosed tags are simpler to spot. MarkdownV2 is more compact to write by hand and supports the same entity set. If you are inserting user-supplied text into messages, HTML tends to cause fewer surprises.
Do I need to escape text inside code blocks?
Inside pre and code entities Telegram only requires the backtick and the backslash to be escaped, not the full set. Inside the parentheses of an inline link, only the closing parenthesis and the backslash. This tool escapes for ordinary message text, which is the strictest case and safe everywhere else.
Does this send my message anywhere?
No. The escaping runs in your browser as you type. Nothing is uploaded, stored or logged, and the tool works with the network disconnected.
Sources
Everything this tool asserts about Telegram comes from Telegram’s own documentation.