Back to Syntax Hub

How to Escape Pipe Characters (|) in Markdown Tables

Because Markdown tables use vertical pipes (|) as column boundaries, entering an unescaped pipe inside a cell causes the parser to split the cell into a new column, breaking your table layout.

Method 1: Escape with a Backslash (\\|)

Prefix the pipe with a backslash. The markdown renderer displays a literal pipe character without treating it as a column delimiter:

| Expression | Meaning |
| :--------- | :------ |
| A \| B     | Logical OR |

Method 2: Inside Inline Code Spans (`foo | bar`)

In GitHub Flavored Markdown (GFM), pipes enclosed within inline code backticks are automatically protected:

| Command | Description |
| :------ | :---------- |
| `grep -E "a|b"` | Match either a or b |

Validate Your Table Syntax

Check for unescaped pipes with our free Table Validator tool.

Check Syntax