Quick Reference
Basic Table Syntax
| Header 1 | Header 2 |
|----------|----------|
| Cell 1 | Cell 2 |
Result
Header 1 | Header 2 |
---|---|
Cell 1 | Cell 2 |
Basic Table Creation
Tables in Markdown use pipes (|) to separate columns and dashes (-) to define the header separator row. This is part of GitHub Flavored Markdown (GFM).
Simple Table
Markdown:
| Name | Age | City | |---------|-----|-----------| | Alice | 25 | New York | | Bob | 30 | London | | Charlie | 35 | Tokyo |
Output:
Name | Age | City |
---|---|---|
Alice | 25 | New York |
Bob | 30 | London |
Charlie | 35 | Tokyo |
Table Without Outer Pipes
Markdown:
Header 1 | Header 2 | Header 3 ---------|----------|---------- Value 1 | Value 2 | Value 3 Data A | Data B | Data C
Output:
Header 1 | Header 2 | Header 3 |
---|---|---|
Value 1 | Value 2 | Value 3 |
Data A | Data B | Data C |
Column Alignment
Control text alignment in columns using colons (:) in the separator row.
Alignment Options
Markdown:
| Left Align | Center Align | Right Align | |:-----------|:------------:|------------:| | Text | Text | Text | | More text | More text | More text | | Even more | Even more | Even more |
Output:
Left Align | Center Align | Right Align |
---|---|---|
Text | Text | Text |
More text | More text | More text |
Even more | Even more | Even more |
Alignment Syntax
:---
- Left alignment (default):---:
- Center alignment---:
- Right alignment
Advanced Table Features
Tables with Formatting
Markdown:
| Feature | **Status** | `Code` | |-------------|------------|----------| | *Italic* | ✅ Done | `active` | | **Bold** | ❌ Pending | `draft` | | ~~Strike~~ | ⚠️ Review | `test` |
Output:
Feature | Status | Code |
---|---|---|
Italic | ✅ Done | active |
Bold | ❌ Pending | draft |
⚠️ Review | test |
Tables with Links
Markdown:
| Site | URL | |-------------|------------------------------| | Google | [google.com](https://google.com) | | GitHub | [github.com](https://github.com) | | Stack O | [stackoverflow.com][so] | [so]: https://stackoverflow.com
Output:
Site | URL |
---|---|
google.com | |
GitHub | github.com |
Stack O | stackoverflow.com |
Best Practices
✅ Best Practices
- Use consistent spacing: Align pipes for better readability in source
- Include headers: Always have a header row for context
- Keep content concise: Tables work best with short cell content
- Use alignment wisely: Numbers right-aligned, text left-aligned
- Test responsiveness: Ensure tables work on mobile devices
❌ Common Mistakes
- Missing separator row: The dash row is required
- Inconsistent columns: All rows must have the same number of columns
- Too much content: Overly long cell content breaks layout
- No header row: Tables need headers for accessibility
- Complex nested content: Tables don't support complex formatting
Common Issues and Solutions
❌ Problem: Pipes in Cell Content
Problematic:
| Command | Description | |---------|-------------| | ls | grep | List and filter |
Solutions:
| Command | Description | |---------|-------------| | `ls \| grep` | List and filter | | ls | grep | List and filter |
Escape pipes with backticks, backslashes, or HTML entities.
❌ Problem: Uneven Columns
Wrong:
| A | B | C | |---|---| | 1 | 2 | 3 | 4 |
Correct:
| A | B | C | |---|---|---| | 1 | 2 | 3 |
Ensure all rows have the same number of columns.
Try Tables Yourself!
Practice table syntax with our free online converter.