How to Convert Markdown to EPUB
A step-by-step tutorial for creating ebooks from Markdown files.
This tutorial walks you through the entire process of converting a Markdown file into an EPUB ebook using mdtoepub.com. Whether you're creating your first ebook or your hundredth, these steps will help you get a professional result in under a minute.
Before You Start
Here's what you'll need:
- A Markdown file (.md) or Markdown text you want to convert
- A modern web browser (Chrome, Firefox, Safari, Edge — any will work)
- Optionally: your ebook's title, author name, and preferred language
That's it. No account, no download, no installation required. The converter runs entirely in your browser — your content never leaves your device.
Step-by-Step Tutorial
Prepare Your Markdown Content
If you already have a .md file, you're ready to go. If
you're starting from scratch, write your content in any text editor
using Markdown syntax. Here's a minimal example:
# My First Ebook
## Chapter 1: Getting Started
This is the first chapter of my ebook. I wrote it in
**Markdown** because it's simple and clean.
Here are some things I love:
- Reading on my Kindle
- Writing in plain text
- Converting to EPUB with one click
## Chapter 2: The Journey
> "The best time to start writing was yesterday.
> The second best time is now."
This chapter continues the story...
---
*Thanks for reading!*
Make sure your Markdown file is saved as UTF-8. This is the default in most modern editors (VS Code, Sublime Text, Notepad++, etc.) and ensures special characters like accents, em-dashes, and non-Latin scripts render correctly in the EPUB.
Open the Converter
Go to mdtoepub.com. You'll see a split-screen interface:
- Left panel: The Markdown editor where you input your content
- Right panel: A live preview showing how your content will look
Below the editor, you'll find metadata fields (title, author, language) and the "Generate EPUB" button.
Load Your Markdown
You have three ways to get your content into the editor:
- Paste: Copy your Markdown text and paste it directly into the editor (Ctrl+V / Cmd+V)
-
Drag & Drop: Drag a
.mdfile from your file explorer and drop it onto the editor area - Open file: Click the "open" button in the editor toolbar and browse for your file
As soon as your content is in the editor, the live preview on the right will update automatically. This shows you exactly how your Markdown will be formatted in the EPUB.
If this is your first time using the converter, click the "sample" button in the editor toolbar to load a pre-written example. This lets you see the full workflow before using your own content.
Review the Preview
Carefully check the preview panel on the right. Look for:
- Are headings displaying at the correct levels?
- Is bold and italic text rendering properly?
- Are lists properly indented?
- Do code blocks appear with monospace formatting?
- Are links and images working?
If something looks wrong, edit the Markdown in the left panel. The preview updates in real-time (with a small ~120ms delay for performance).
Make sure there's a space after the hash symbol in
headings. #Heading won't work — it needs to be
# Heading (with a space). This is the most common
Markdown formatting error.
Set Ebook Metadata
Below the editor, you'll find three metadata fields:
- Title: The name of your ebook. If left blank, the converter uses the first H1 heading in your Markdown. If there's no H1, it defaults to "Article".
- Author: Your name or pen name. Defaults to "Unknown" if left blank.
- Language: Select from English, Portuguese, Spanish, French, or German. This affects hyphenation and text-to-speech behavior on e-readers.
Setting proper metadata is important because it's what appears in your e-reader's library. A well-titled ebook is easier to find among hundreds of documents.
Generate and Download the EPUB
Click the golden "Generate EPUB" button. Within less than a second:
- The converter parses your Markdown into semantic HTML
- Wraps the HTML in EPUB 3 structure (XHTML, OPF, navigation, CSS)
-
Packages everything into a ZIP file with
.epubextension - Triggers a download in your browser
The EPUB file is saved to your default downloads folder. The
filename is based on your ebook title (slugified), for example:
my-first-ebook.epub.
The status bar below the button will show the filename and file size (typically 5-50 KB for text-only ebooks).
What to Do With Your EPUB
Now that you have an EPUB file, here's how to read it on different devices and platforms:
On Amazon Kindle
Kindle has natively supported EPUB since late 2022. You have several options:
- Email it: Send the EPUB file as an email attachment to your Kindle's email address (found in Amazon account settings → Devices → Kindle → Email). The ebook will appear in your Kindle library within a few minutes.
- Use the Send to Kindle app: Download Amazon's free Send to Kindle desktop app. Drag and drop your EPUB file onto the app.
-
USB cable: Connect Kindle via USB, and copy the
EPUB to the
Documentsfolder on the device.
On Kobo
Kobo e-readers natively support EPUB. Connect your Kobo via USB and drag the file into the device's storage. It will appear in your library immediately. Alternatively, use Kobo's built-in browser to download the file directly.
On Apple Books (iPhone, iPad, Mac)
On macOS, double-click the EPUB file and it will open in Apple Books. On iOS/iPadOS, you can AirDrop the file to your device, email it to yourself and open the attachment, or save it to Files and open with Apple Books.
On Google Play Books
Go to play.google.com/books, click the upload button, and select your EPUB file. It will sync to all devices with the Google Play Books app installed.
On a Computer
For reading EPUBs on your computer, you can use:
- Calibre — free, open-source ebook management and reader (Windows, Mac, Linux)
- Thorium Reader — free, modern EPUB reader (Windows, Mac, Linux)
- Microsoft Edge — has built-in EPUB support on Windows
- Apple Books — built into macOS
Real-World Examples
Here are some practical scenarios showing how people use the Markdown to EPUB converter:
Example 1: Blog Post to Ebook
Sarah is a food blogger who writes recipes in Markdown. She wants to create a collection of her best recipes as a downloadable EPUB for her newsletter subscribers. She concatenates 20 recipe Markdown files into one document, with each recipe under an H2 heading, pastes it into the converter, sets the title to "Sarah's Kitchen: 20 Favorite Recipes", and downloads the EPUB.
Example 2: Developer Documentation
Alex maintains an open-source library on GitHub. His README is comprehensive but hard to read on a phone. He copies the README into the converter, generates an EPUB, and sends it to his Kindle for comfortable reading during his commute.
Example 3: Academic Notes
Maria is a university student who takes lecture notes in Markdown using Obsidian. Before exams, she consolidates her notes for each subject into a single Markdown file and converts it to EPUB. She reads the notes on her Kobo e-reader in the library — no screen glare, no social media distractions, longer battery life than a laptop.
Example 4: Fiction Writing
Tom is writing a novel in Markdown using iA Writer. After finishing each draft, he converts it to EPUB and sends it to his Kindle for proofreading. Reading his own work on an e-reader (a different medium than where he writes) helps him catch typos and pacing issues he'd otherwise miss.
Tips for Better EPUB Output
Follow these tips to get the best possible ebook from your Markdown:
1. Structure Your Content with Headings
Use H1 for the main title, H2 for chapters or major sections, and H3 for subsections. E-readers use headings for navigation, so a well-structured document creates a better reading experience.
2. Keep Paragraphs Short
E-reader screens are small. Long paragraphs become intimidating walls of text. Aim for 3-5 sentences per paragraph for optimal readability.
3. Use Formatting Sparingly
Bold and italic text are powerful tools when used sparingly. If everything is emphasized, nothing stands out. Use bold for key terms and italic for emphasis, titles, and foreign words.
4. Test on Your Target Device
If you're primarily reading on Kindle, test the EPUB on your Kindle device or the Kindle app. Different e-readers render content slightly differently, and what looks perfect in the preview might need small adjustments for your specific device.
5. Set Meaningful Metadata
A title like "Untitled" or "Document" makes your ebook hard to find in a library of hundreds. Take a few seconds to set a clear title and your author name.
6. Use Section Dividers
Use horizontal rules (---) to create visual breaks
between major sections. In the EPUB, these render as a subtle line
that helps readers understand the document's structure.
7. Preview Before Downloading
Always check the live preview before generating the EPUB. It's much easier to fix formatting in the editor than to regenerate the file.
Frequently Asked Questions
Q: Can I convert multiple Markdown files into one EPUB?
Currently, the converter handles one Markdown input at a time. To combine multiple files, concatenate them in a text editor (with H2 headings separating each section) before pasting into the converter.
Q: Is there a file size limit?
There's no hard limit since everything runs in your browser. However, extremely large documents (over 1 million characters) may cause your browser to slow down during preview rendering. For very large books, consider splitting into volumes.
Q: Can I customize the EPUB's styling?
The converter uses a carefully designed CSS stylesheet optimized for e-readers. Currently, custom CSS is not supported through the web interface, but we're working on adding theme options in a future update.
Q: Does it support right-to-left (RTL) languages?
The EPUB structure supports RTL languages, but the current CSS is optimized for LTR scripts. RTL languages like Arabic and Hebrew may require manual CSS adjustments in the generated EPUB.
Q: Can I use this for commercial ebooks?
Absolutely. There are no restrictions on how you use the EPUB files generated by this tool. You retain full ownership of your content.
Ready to Create Your Ebook?
Open the converter, paste your Markdown, and download your EPUB in seconds.
Start Converting →Need more background? Check out our Complete Guide to Markdown and EPUB for in-depth explanations of both formats, advanced techniques, and troubleshooting tips.