How to Convert HTML to Markdown Files in Bulk
Markdown is a plain text format that marks headings, links and lists with a few symbols, which makes it handy for notes, documentation and static sites. A web page carries far more than that. Layout boxes, style sheet colours and scripts have nowhere obvious to go, so some of your page will drop out on the way. Your job is to keep the parts that matter and spot what went missing. Below you’ll find a table of what each web element turns into, four conversion routes and a PowerShell check that was run on sample MD files in Windows PowerShell 5.1. Pandoc, Google Docs and the desktop converter are described from their own documentation and screens and weren’t run for this guide. If you want one combined document instead of one per page, read how to merge HTML files to Markdown.
What Each Web Page Part Becomes in Markdown
Use this table while you review any converter’s output. It tells you what you should expect to see.
| Web Page Part | Markdown Form | Watch For |
|---|---|---|
| Headings H1 to H6 | # Title down to ###### Title |
Keep one top heading per page |
| Bold and italic | **bold** and *italic* |
Font size and colour have no symbol |
| Links | [text](address) |
Short relative addresses stay relative |
| Pictures |  |
Only the path is stored, not the image |
| Lists | - for bullets, 1. for numbers |
Indent the nested items |
| Code blocks | Three backticks above and below | The closing line holds backticks only |
| Tables | Pipes and hyphens on GitHub | No lists or code blocks inside a cell |
| Layout boxes and styles | None | Drop them or keep raw HTML |
| Scripts | None | GitHub filters the script tag |
Most symbols follow the CommonMark specification, which also lets a block of raw HTML stay as it is. Tables come from the GitHub Flavored Markdown spec. Note that GitHub filters some raw tags when it shows a page, including script, style and iframe.
How to Convert HTML to Markdown by Hand
A page of a few paragraphs is often quick to rewrite, and you get clean text with no leftovers.
- Open the page in your browser and start a blank file in Notepad.
- Copy the text across and type
#signs in front of each heading. - Rewrite the links and pictures in the bracket forms from the table.
- Choose Save As, set the type to All Files, add
.mdto the name and keep UTF-8 encoding.
Limitations: long pages take a while and a missed link is easy to overlook. Compare your file against the original before you delete anything.
Convert HTML to Markdown Through Google Docs
Google Docs gives you a route with nothing to install, as long as you’re comfortable uploading the page.
- Upload the saved .html page to Google Drive.
- Open the upload with Google Docs. Google’s developer guide lists HTML among the types Drive can turn into a Doc.
- Choose File >> Download and select Markdown (.md). Google announced this in its Markdown import and export update.
Limitations: pictures kept in a folder on your PC aren’t uploaded along with a lone page. Read the headings and tables in the download before you trust it, and don’t upload anything private without permission.
Pandoc for Readers Who Like a Terminal
Pandoc is a free converter that reads HTML and writes several Markdown flavours, with gfm as the name for GitHub’s. Its user guide also describes the --extract-media option, which collects linked pictures into a folder you name and updates the references to match.
Limitations: you need to install it and work from a command prompt. Pandoc wasn’t run for this guide, so take the exact commands from its manual.
Batch Convert HTML to Markdown on Windows
To handle a folder without typing commands, the 4n6 Document Converter reads saved pages and writes MD files on Windows. Its HTML converter page lists the other output types.
- Install the converter and open it.
- Go to Open >> HTML Files, then use Choose Files or Choose Folders.
- Open the Export menu and select MD.
- Set your output folder with Browse on MD Export Options, then select Save.
- Open the output folder and run the check from the next section.
Limitations: the app’s own message says the demo edition exports only 2 items. A paid licence lifts that cap.
Compare 2 Converted Pages First
Choose pages with a table and a picture so the demo shows you the hard parts.
Check Your MD Files With PowerShell 5.1
Conversion faults hide well in a long folder. The script below opens each MD file in C:\HtmlToMd and reports its size, the number of leftover HTML tags and any local picture it can’t find.
$folder = "C:\HtmlToMd"
foreach ($file in Get-ChildItem "$folder\*.md") {
$text = [System.IO.File]::ReadAllText($file.FullName)
$tags = [regex]::Matches($text, '<(div|span|table|style|script|font)\b').Count
$missing = foreach ($m in [regex]::Matches($text, '(?:!\[[^\]]*\]\(|<img[^>]*?src=")([^)"\s]+)')) {
$src = $m.Groups[1].Value
if ($src -notmatch '^(https?:|data:)') {
$target = Join-Path $file.DirectoryName ([uri]::UnescapeDataString($src))
if (-not (Test-Path -LiteralPath $target)) { $src }
}
}
"$($file.Name): $($file.Length) bytes, $tags HTML tags, missing pictures: $($missing -join ', ')"
}
On a sample folder, the check named one missing picture, counted one leftover div tag and showed an empty file at 0 bytes. Nothing in your folder is edited, so you can run it as often as you like.
Limitations: only six tag names are counted, tags shown inside code examples are counted too and pictures on web addresses are skipped.
5 Checks Before You Publish the MD Files
- Every source page produced a file with real text in it.
- Each file starts with a single
#heading. - Pictures appear in your editor’s preview.
- Tables line up and haven’t lost rows.
- Links open the targets you expect.
Need other targets for the same saved pages? You can export HTML to ODT, turn HTML into XPS or try an HTML to EPUB exporter.
3 Conversion Problems and Their Fixes
Pictures Show as Broken Icons
A relative picture path is usually read from the folder that holds the MD file. Do this: keep the image folder beside your file or correct the paths, then rerun the check. To preview the result in a browser, see how to export Markdown files to HTML.
Tables With Merged Cells Fall Apart
GitHub’s pipe table has no mark for a merged cell. Do this: keep that table as raw HTML inside the file, or split the merged cell before converting. If the table started life in Word, read how to export DOC to MD instead.
The Output File Is Nearly Empty
Pages that build their text with scripts are a common cause. Do this: load it in a browser, wait for the text to appear, then copy it into a new file. When plain words are enough, export HTML to TXT.
Frequently Asked Questions
How do I convert HTML to Markdown?
Rewrite a short page by hand, download it from Google Docs or run pandoc. On Windows without commands, the 4n6 Document Converter writes MD files.
Can I convert many pages to MD at once?
Yes. Pandoc can be scripted across a folder and the desktop converter loads whole folders.
Does Markdown keep CSS styling?
No. Colours, fonts and layout boxes have no Markdown symbol of their own.
Can I keep HTML inside a Markdown file?
Yes. CommonMark accepts blocks of raw HTML, although some sites filter certain tags.
How are HTML tables converted?
A plain grid can become a pipe table. A complex one is safer when it stays as HTML.
Are my images stored inside the MD file?
No. The usual picture mark stores a path, so send the picture folder along with the text.
Can Google Docs export Markdown?
Yes. Google added a Markdown choice under the download menu in 2024.
Can I turn an MD file into a PDF afterwards?
Yes. The guide to export Markdown to PDF covers that step.
Which Way to Markdown Suits Your Pages?
One short page: rewrite it by hand.
A page you’re happy to upload: go through Google Docs.
Repeat jobs and terminal comfort: learn pandoc.
A Windows folder and no commands: try the desktop converter on a small batch.



