Skip to content

Message Formatting (Telegram HTML-Compatible) ​

This page describes how to format messages using Telegram-compatible HTML markup.
Use these tags if you want your messages to appear correctly when sent through Telegram bots or clients that accept HTML formatting.

Basic Formatting Tags ​

New line ​

html
/n

Bold ​

html
<b>Your text</b>

Italic ​

html
<i>Your text</i>

Underline ​

html
<u>Your text</u>

Strikethrough ​

html
<s>Your text</s>

Monospace ​

html
<code>Your text</code>

Preformatted block ​

html
<pre>Your text</pre>

Preformatted block with language ​

html
<pre><code class="language-python">\nprint("Hello")\n</code></pre>
html
<a href="https://example.com">Open website</a>

Special Notes ​

  • Telegram only allows specific HTML tags - others will be stripped.
  • Tags must be properly closed or formatting will break.
  • Nested tags work but must be valid HTML.
  • Make sure you are using correct espace characters for preferred POST method. Often you would need to escape <, >, ""

Examples ​

Example 1: Multiple styles ​

html
<b>Bold</b>, <i>Italic</i>, <u>Underline</u>, <s>Strike</s>

Example 2: Code snippet ​

html
<pre><code class=\"language-js\">\nconsole.log(\"Hello!\");\n</code></pre>