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 textAll of _ * [ ] ( ) ~ ` > # + - = | { } . !
Inside `inline code`Backtick ` and backslash \ only
Inside ```pre block```Backtick ` and backslash \ only
Inside link/text-mention URLParens ) and backslash \ only

Common gotchas

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