Telegram bots support a limited set of HTML tags for styling messages. This guide explains which tags work, how to use them, and the best practices for formatting text in your MisterChatter bot.
Why Use Telegram Formatting? #
Formatting helps make your messages clear and engaging:
- Highlight important details with bold or italic.
- Share structured info like prices, FAQs, or code snippets.
- Add links to resources without clutter.
This improves readability, makes answers more professional, and ensures users don’t miss key points.
Supported HTML Tags in Telegram #
Here’s a full list of HTML tags supported in Telegram bots:
HTML Code | Preview |
---|---|
<b>Bold</b> | Bold |
<strong>Bold</strong> | Bold |
<i>Italic</i> | Italic |
<em>Italic</em> | Italic |
<u>Underline</u> | Underline |
<ins>Underline</ins> | Underline |
<s>Strike</s> or <strike>Strike</strike> | |
<code>inline code</code> | inline code |
<pre>preformatted block</pre> |
preformatted block |
<a href="https://example.com">Link text</a> | Link text |
Note: Telegram does not support <br> in bot messages. Use \n
for line breaks inside your string content.
Examples of Common Use Cases #
1 Bold and Italic for emphasis
#
2 Sharing a link
#
3 Showing inline code
#
4 Preformatted block
#
Best Practices for Telegram HTML Formatting #
- Keep it simple: Too much styling can make messages harder to read.
- Use bold for key facts: Pricing, deadlines, important instructions.
- Links should be descriptive: Instead of “click here,” use “View Pricing.”
- Test before sending: Make sure your tags render correctly in your bot.
With the right HTML formatting, your bot’s messages will look cleaner, more professional, and more helpful improving both user experience.
Telegram supports a limited set of HTML tags including <b>, <strong>, <i>, <em>, <u>, <ins>, <s>, <strike>, <code>, <pre>, and <a>. These cover basic formatting like bold, italic, underline, strikethrough, inline code, code blocks, and links.
No, Telegram does not support <br> tags. Use \n in your message string to add line breaks instead.
Telegram bots allow both HTML and Markdown for formatting, but HTML gives you more control over links and styling. For example, links in Markdown must display the full URL, while in HTML you can set custom link text.
No, Telegram limits formatting to ensure consistency and readability across devices. You can only use the supported tags listed in this guide.
Send your message in a test chat or group where your bot is active. If the formatting is invalid, Telegram will often ignore the tag and display plain text.
The most common issues are incorrect tag nesting, unsupported tags, or forgetting to set your bot’s parse_mode to HTML. Double‑check your code and settings.