Fix Pipe Characters That Break a Markdown Table
A literal | inside a cell starts a new column and breaks the table. Escape it as \| so the renderer prints the character instead of splitting the row.
Direct answer
In a Markdown table the pipe character separates columns, so a pipe inside cell text splits that row into extra columns. Escape it with a backslash: write `\|` instead of `|`. The converter above does this for every cell when the 'Escape pipe characters' option is on, so pasted values such as `a|b` survive as text.
Open Excel to Markdown converterWhen to use this
- One row in a rendered table has more columns than the others.
- Cells hold shell commands, regular expressions, or union types that contain pipes.
- Copied spreadsheet values include a pipe as a separator inside a single cell.
Steps
- Paste the cells into the converter above.
- Leave 'Escape pipe characters in cells' on.
- Look at the live output and confirm each row has the same number of columns.
- Press Copy and paste the table into your document.
- Preview the rendered table to confirm the pipe now prints as a character.
Example conversion
Command Meaning ls | wc -l Count files grep a|b Match a or b
| Command | Meaning | | --- | --- | | ls \| wc -l | Count files | | grep a\|b | Match a or b |
Common mistakes
- Do not wrap the cell in backticks and expect the pipe to be safe. Inline code does not stop a table row from splitting; the backslash escape is still required.
- Do not escape pipes twice. `\\|` prints a backslash followed by a broken column.
- Line breaks inside a cell also break tables. Replace them with `<br>` or remove them before converting.
FAQ
- Why does a pipe inside backticks still break the table?
- Table rows are split into cells before inline code is parsed, so the pipe is treated as a column separator first. Escaping with a backslash is the fix that works in GitHub Flavored Markdown.
- Should I escape every pipe in the document?
- Only pipes inside table cells need escaping. Pipes in normal paragraphs or fenced code blocks are safe as-is.
- Does the converter escape anything else?
- It escapes pipe characters and it collapses line breaks inside a cell so each row stays on one line. Other Markdown characters are left as typed.
Related Excel to Markdown guides
How to Paste Excel Cells as a Markdown Table
Copied Excel cells travel as tab-separated text. Paste them into the converter and get a GitHub Flavored Markdown table with the header row and alignment you choose.
Convert Google Sheets Cells to a Markdown Table
Google Sheets copies a selected range as tab-separated text plus an HTML table. Paste either flavour into the converter to get a Markdown table.
Put an Excel Table Into a GitHub README
GitHub renders GitHub Flavored Markdown tables. Convert copied Excel cells to GFM pipe syntax, then paste the result into README.md.
How to Align Columns in a Markdown Table
Alignment lives in the separator row. A colon on the left aligns left, on the right aligns right, and on both sides centres the column.