Since 2024, Google Docs reads and writes Markdown natively, which handles one file well. Joining many files in order is the part that still needs a method.
Since October 2026, Google Docs can also open and edit .md files directly in Markdown Mode without converting them. It still opens one file at a time.
- Merge with pandoc and create the PDF in one command
- Merge with the free online Markdown merger
- Combine them in Google Docs with native Markdown
- Merge with Merge Docs Pro and export PDF, Word or EPUB
Merging Markdown files with pandoc
Use this when you are comfortable with a terminal and want a repeatable build from Markdown sources.
- Install pandoc. For PDF output you also need a LaTeX engine such as TeX Live or MiKTeX.
- Name the files in reading order, for example
01-intro.md,02-setup.md. - In the folder, run:
pandoc 01-intro.md 02-setup.md 03-usage.md -o merged.pdf- For a table of contents, add
--toc -s. For Word or EPUB, change the extension tomerged.docxormerged.epub.
Result: One PDF built from all the files. Pandoc joins multiple input files with blank lines between them before converting.
To get one combined Markdown file instead, run this on Mac, Linux or Git Bash:
for f in 0*.md; do cat "$f"; echo; done > combined.mdThe echo adds a blank line so a heading at the top of one file doesn’t stick to the last line of the previous file.
Merging Markdown files with the free online tool
Use this when you only need one combined .md file and don’t want to install anything.
- Open the free online Markdown merger.
- Add up to five .md files.
- Drag them into order and click Merge and Download.
Result: A single combined .md file. To turn it into a PDF, open it in Google Docs or run it through pandoc.
Combining Markdown files in Google Docs
Use this when you have a few files and want to review and edit the result before making the PDF.
- In Google Docs, turn on Tools > Preferences > Enable Markdown.
- Open each .md file in a text editor and copy its contents.
- In one Google Doc, right-click and choose Paste from Markdown. Repeat for each file, adding a page break with Ctrl + Enter (Windows) or Cmd + Enter (Mac) between them.
- Click File > Download > PDF document (.pdf).
Result: An editable Google Doc and a PDF. You can also export the combined Doc back to Markdown with File > Download > Markdown (.md).
Tip: To open a single Markdown file directly, use File > Open > Upload in Docs, or upload it to Drive and choose Open with > Google Docs.
Merging Markdown files with Merge Docs Pro
Use this when you have many files, mix Markdown with Google Docs or Word, or want PDF, Word and EPUB from one run.
Upload the .md files to Google Drive.
Open a Google Sheet and click Extensions > Merge Docs Pro > Merge Google Docs, then click Add Column Headers to Get Started.
Click Select Google Docs or Drive Files to Merge and pick the Markdown files. Their File Type is set to Markdown automatically.

Reorder the rows, and set Merge to No for any file you want to skip.
Tick Add page break before each merge so each file starts on a new page.

Tick Save merged Docs as PDF, and optionally Save merged Docs as Word or Save merged Docs as ePUB.

Click Merge Docs.
Result: One Google Doc plus the PDF and any other formats you selected. The full option list is in the Merge Docs Pro help.

The same add-on can merge Markdown with Google Docs and Word files in one run.
Comparing the methods
| Method | Best for | Works on |
|---|---|---|
| pandoc | Repeatable builds, Git repos, docs-as-code | Windows, Mac, Linux (command line) |
| Free online merger | A quick .md-only merge of up to five files | Any modern browser |
| Google Docs native Markdown | A few files you want to edit before export | Google Docs on a computer |
| Merge Docs Pro | Many files, mixed formats, PDF/Word/EPUB output | Google Sheets or Docs in a desktop browser |
Platform differences
- Windows: pandoc runs in PowerShell or Command Prompt. The
forloop above needs Git Bash or WSL. - Google Docs: the Markdown preference, Paste from Markdown and Markdown download are for Docs on a computer.
- Flavours differ. Tables, task lists, footnotes and front matter are extensions to CommonMark, so check how each tool handles them.
Troubleshooting
- Images are missing. Relative paths like
./img/a.pngonly work where those files exist. Cloud tools need publicly accessible image URLs. - Headings merge into the previous paragraph. A file didn’t end with a blank line. Add one, or use pandoc, which inserts it for you.
- pandoc says it can’t find pdflatex. Install a LaTeX distribution, or set another engine with
--pdf-engine. - Front matter shows up as text. YAML blocks at the top of each file aren’t part of standard Markdown. Remove them before merging, or let pandoc read them as metadata.
- Footnotes collide across files. In pandoc, add
--file-scopeso each file’s footnotes are kept separate.
For the PDF side of things, see how to combine Google Docs into a single PDF. If your sources are headed for LaTeX instead, read our Google Docs to LaTeX guide. More options are in the merge documents guides.