Markdown Center Text: How to Center Align Headings & Images

Markdown does not have a native centering syntax. To center text in Markdown, use the HTML tag <p align="center">Centered text</p> or <div style="text-align: center">Centered text</div>.

Syntax Code Snippet
<p align="center">
  <b>This headline is centered</b><br/>
  This descriptive text is centered below it.
</p>
Rendered HTML Output Preview

This headline is centered

This descriptive text is centered below it.

Platform Compatibility & Differences

GitHub (GFM):

GitHub READMEs support `<p align="center">` and `<div align="center">` tags.

Discord Chat:

Discord does NOT support center alignment or HTML tags.

Reddit:

Does not support center alignment.

Jupyter Notebooks:

Supported via HTML elements.

How to Use Markdown Center Text

  1. Copy the ready-to-use Center Text syntax snippet below.
  2. Inspect the rendered live preview in both light and dark themes.
  3. Review platform compatibility differences for GitHub, Discord, Reddit, and Jupyter notebooks.
  4. Check common pitfalls and copy formatted snippets directly.

Practical Examples

Center Text Syntax Pattern

Centering is useful for titles, logos, badge ribbons, and hero sections in documentation.

Input:
<p align="center">
  <b>This headline is centered</b><br/>
  This descriptive text is centered below it.
</p>
Output:
Rendered visual format

Common Mistakes & Troubleshooting

  • Expecting Discord or Slack to center text using HTML tags.
  • Forgetting to close the closing `</p>` or `</div>` tag.

Frequently Asked Questions

Can I center an image in Markdown?

Yes! Place the image inside a center paragraph: `<p align="center"><img src="logo.png" alt="Logo" /></p>`.