Markdown Tables
Tables are an great way to structure data and information into a readable format. Although tables are not part of the original Markdown specification, tables are supported in GitHub Flavored Markdown and many other Markdown flavors.
Basic table syntax
Markdown tables are created using pipes | between columns and hyphens - to create a header row:
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Row 1    | Data     | Data     |
| Row 2    | Data     | Data     |
| Row 3    | Data     | Data     |
Rendering in the document as:
| Header 1 | Header 2 | Header 3 | 
|---|---|---|
| Row 1 | Data | Data | 
| Row 2 | Data | Data | 
| Row 3 | Data | Data | 
Aligning columns
A colon : is used in the header row to align the content inside the columns:
- Align left (default): |-------|
- Align center: |:-----:|
- Align right: |-------:|
| Left-aligned | Center-aligned | Right-aligned |
|:-------------|:--------------:|--------------:|
| Left         | Center         | Right         |
| Left         | Center         | Right         |
Aligning the text in each column as follows:
| Left-aligned | Center-aligned | Right-aligned | 
|---|---|---|
| Left | Center | Right | 
| Left | Center | Right | 
Simplified syntax
The pipes | at the beginning and end of each row are optional:
Header 1 | Header 2
--- | ---
Data | Data
Data | Data
Displaying as a regular table:
| Header 1 | Header 2 | 
|---|---|
| Data | Data | 
| Data | Data | 
This still renders as a properly formatted table. However, for readability in the source file, it's generally recommended to:
- Use the outer pipes.
- Align the pipe characters vertically.
- Use at least three hyphens (---) for each column in the header row.
Formatting table content
Table cells can include most formatting options:
| Type | Output |
|------------|---------|
| Italic     | *Italic text* |
| Bold       | **Bold text** |
| Code       | `code` |
| Link      | [Click me](https://learn-webdevelopment.com/course/markdown/more-advanced-features/markdown-tables) |
Rendering as:
| Type | Output | 
|---|---|
| Italic | Italic text | 
| Bold | Bold text | 
| Code | code | 
| Link | Click me | 
Escaping Pipe Characters
If you need to include a pipe character | within your table content, you can escape it with a backslash \:
| Heading 1 | Heading 2 |
|----------|----------|
| Data   | Data   |
| Data with \| pipe | Data |
| Heading 1 | Heading 2 | 
|---|---|
| Data | Data | 
| Data with | pipe | Data | 
Empty Cells
To create an empty cell, simply leave the cell empty between the pipes:
| Heading 1 | Heading 2 | Heading 3 |
|----------|----------|----------|
| Data     |          | Data     |
|          | Data     | Data     |
Rendering as:
| Heading 1 | Heading 2 | Heading 3 | 
|---|---|---|
| Data | Data | |
| Data | Data |