Tables are great for comparing options, listing features, or presenting structured data. Markdown tables use pipes | to separate columns and hyphens - to define the header row.
Basic Table
| Name | Age | City |
| ------- | --- | --------- |
| Alice | 28 | Mumbai |
| Bob | 34 | Bangalore |
| Charlie | 22 | Delhi |
| Name | Age | City |
|---|---|---|
| Alice | 28 | Mumbai |
| Bob | 34 | Bangalore |
| Charlie | 22 | Delhi |
The first row is the header. The second row of hyphens --- separates the header from the data rows. Every row after that is a data row.
HTML equivalent:
<table>
<thead>
<tr><th>Name</th><th>Age</th><th>City</th></tr>
</thead>
<tbody>
<tr><td>Alice</td><td>28</td><td>Mumbai</td></tr>
</tbody>
</table>
Column Alignment
Control alignment by adding a colon : to the separator row.
| Syntax | Alignment |
|---|---|
--- | Left (default) |
:--- | Left (explicit) |
---: | Right |
:---: | Center |
| Left | Center | Right |
| :------ | :-----: | ------: |
| Apple | Banana | Cherry |
| 100 | 200 | 300 |
| Left | Center | Right |
|---|---|---|
| Apple | Banana | Cherry |
| 100 | 200 | 300 |
Formatting Inside Cells
You can use inline Markdown inside table cells — bold, italic, inline code, and links all work.
| Feature | Status | Docs |
| ------------- | ------------- | --------------------------------- |
| **Bold text** | _Italic text_ | [Link](https://example.com) |
| `inline code` | ~~removed~~ | [Guide](https://meshworld.in/) |
| Feature | Status | Docs |
|---|---|---|
| Bold text | Italic text | Link |
inline code | Guide |
You cannot use block-level elements (like code blocks or lists) inside a table cell.
Column widths
The column widths in your raw Markdown don’t need to match — the renderer calculates them automatically. These two tables produce identical output:
| Name | Age |
| --- | --- |
| Alice | 28 |
| Name | Age |
| ------- | --- |
| Alice | 28 |
Spacing the columns consistently is purely for readability of the raw source.
Best Practices
- Use tables for genuinely tabular data — comparisons, feature lists, reference tables.
- Don’t use tables to force layout — that’s what CSS is for.
- Keep cell content short. Long sentences inside table cells are hard to read.
- Left-align text, right-align numbers — it’s easier to scan.
Quick Reference
| Header 1 | Header 2 | Header 3 |
| :------- | :------: | -------: |
| left | center | right |
Hope you like this!
Keep helping and happy coding
Related Articles
Deepen your understanding with these curated continuations.
Horizontal Rules & Line Breaks in Markdown
Master horizontal rules and line breaks in Markdown. Learn how to separate sections with ---, ***, or ___ and when to use trailing spaces vs blank lines.
Images in Markdown - Complete Guide
Learn how to embed images in Markdown with alt text for accessibility and SEO. Covers inline syntax, local images, linked images, and reference-style syntax.
Mastering Blockquotes in Markdown - Complete Guide
Learn how to use blockquotes in Markdown for quotes, callouts, and notes. Covers basic syntax, nested blockquotes, multi-paragraph, and best practices.