Markdown to LaTeX

Paste Markdown or plain text on the left. Get LaTeX on the right that compiles in Overleaf without errors — special characters escaped, packages worked out for you, and a warning for anything that needs your attention. Everything runs in your browser; nothing is uploaded.

← Back to resources
Output
Document
Code blocks
Options

Markdown in

0 chars · 0 words

LaTeX out

0 chars · 0 lines
Paste something to get started.
Why Markdown → LaTeX usually breaks (and what this tool does about it)

Most Markdown-to-LaTeX conversions fail for the same handful of reasons. None of them are exotic, and all of them produce errors that are hard to read if you did not write the converter yourself. Here is what actually goes wrong.

1. Escaping is not a find-and-replace

LaTeX reserves ten characters: # $ % & _ { } ~ ^ \. They have to be escaped in ordinary prose — but not inside maths, not inside code blocks, and not inside URLs or image filenames. A converter that escapes first destroys the Markdown syntax it was about to read; one that converts first ends up escaping the LaTeX commands it just wrote.

The classic symptom is an underscore in a filename. my_plot.png becomes my\_plot.png, and Overleaf then reports a missing file — which looks like an upload problem, not an escaping problem. This tool sets aside code, maths and URLs as opaque tokens before it escapes anything, so those regions are structurally unreachable by the escaper.

2. A stray percent sign silently eats the rest of the line

% starts a comment in LaTeX. An unescaped one in a URL or in body text does not produce an error where it occurs — it deletes everything after it on that line, and you usually find out several lines later when a brace no longer matches. It is one of the most confusing errors in LaTeX precisely because the message points somewhere else.

3. Overleaf compiles with pdfLaTeX by default, and pdfLaTeX cannot read most Unicode

If you paste text containing a curly quote, an en dash, an arrow, a Greek letter, a CJK character or an emoji, pdfLaTeX raises ! Package inputenc Error: Unicode character … not set up for use with LaTeX. This is a hard error, not a warning. This tool maps roughly eighty common symbols to proper LaTeX commands, strips emoji (pdfLaTeX cannot render them at any setting), and lists by code point anything it could not map — so you can either remove those characters or switch Overleaf to XeLaTeX or LuaLaTeX under Menu → Compiler.

4. Tables break when a row has the wrong number of cells

Markdown tolerates a ragged table. LaTeX does not: a row with more cells than the column specification gives ! Extra alignment tab has been changed to \cr. Rows are padded or truncated here, and you get told which ones.

5. Lists cannot nest more than four deep

LaTeX raises ! Too deeply nested at the fifth level of itemize or enumerate. There are packages that lift the limit, but the honest fix is to restructure the list, so deeper items are flattened to level four and flagged.

6. Task lists collide with the optional argument of \item

\item [x] do the thing does not print "[x]" — LaTeX reads [x] as the item's optional label and quietly replaces the bullet with it. Any list item whose text begins with a bracket needs a {} in front. It is a small thing that bites everyone who converts a GitHub-style checklist.

7. \verb is fragile, so this tool does not use it

\verb is the obvious choice for inline code, but it fails inside any moving argument — you cannot use it in \section{}, \caption{} or \footnote{}. Inline code is emitted as \texttt{} with the contents escaped, which works everywhere.

8. Currency looks exactly like maths

$ opens maths mode, so "it costs $5 and $10" silently becomes an italic formula and throws the rest of the document out of alignment. Distinguishing the two cases needs more than a naive pair-match: the rule here follows Pandoc (no space just inside the delimiters) plus a digit check, which correctly leaves $5-$7 and $1,200 as text while still recognising $x^2$ as maths.

What the preamble does

Only packages that are actually needed get loaded, in an order that matters — hyperref must come last, xurl immediately before it, and lmodern after fontenc. Two are always included and are worth knowing about: fontenc with the T1 option, because without it <, > and | typeset as inverted punctuation rather than themselves; and lmodern, because T1 without it makes pdfLaTeX fall back to bitmap fonts. If you pick "Body only", the same list is emitted as a comment so you can copy the missing lines into your existing preamble.

Everything above runs locally in your browser. Nothing you paste is uploaded, logged or stored.