0 lines
Compressed Markdown Waiting

Paste Markdown or open a .md file. The compressed version shows up here as you type, checked to render the same as your original.

0% smaller 0 B → 0 B GZIP – 0 → 0 lines

Runs entirely in your browser. Your Markdown is never uploaded.

This Markdown compressor cleans up .md files by removing HTML comments, extra blank lines, trailing spaces and the padding in tables, without changing how the file looks when it’s rendered. Paste your Markdown or open a file, and the compressed version updates as you type. Every result is rendered and compared with your original, so you can see it displays the same before you download it. There’s also a Changes tab that shows every edited line, a Preview tab, and a GZIP download for the biggest savings.

How to compress a Markdown file

  1. Paste your Markdown into the left box, use Open file, or drag a .md file onto the box.
  2. Pick what to clean up. Everything except Remove front matter is on by default, because none of it changes the rendered page.
  3. Check the stats bar for Renders the same, look at the Changes tab to see removed lines in red and edited lines in amber, or open Preview to see the rendered result.
  4. Copy the result, download the smaller .md, or download a .gz copy.

What each option does

OptionWhat it doesChanges the rendered page?
Remove commentsRemoves <!-- comments -->, both on their own lines and inside paragraphs. Comments inside code are left alone, and so are comments that tools rely on (see below).No. Comments never show on the page.
Collapse blank linesTurns runs of blank lines into one, and removes blank lines at the start and end of the file.No
Trim trailing spacesRemoves spaces and tabs at the end of lines. Two spaces at the end of a line inside a paragraph make a line break, so those are kept.No
Compact tablesRemoves the spaces that line up table columns, and shortens divider rows like |----------| to |---|. Alignment colons are kept.No. Tables keep their columns and alignment.
Tidy headings & rulesTurns #   Title ## into # Title, shortens long horizontal rules and heading underlines to three characters, and rewrites spaced rules like - - - as ***.No
Remove front matterRemoves the YAML (---) or TOML (+++) block at the top of the file.Off by default. Jekyll, Hugo, Astro, Eleventy and Docusaurus read the title, date and layout from it.
Line breaksKeeps two-space line breaks, or swaps them for a backslash (\), which can’t be lost by an editor that trims spaces. Backslash breaks work in CommonMark and GitHub, but not in every older parser.No
Line endingsKeeps the file’s original line endings, or converts to LF or CRLF.No

Before and after

#   Release notes   #
Version 2.1 fixes the export bug.···
Thanks to everyone who reported it!···
<!-- TODO: link the issue -->

| Platform   | Status    |
|------------|-----------|
| Windows    | Fixed     |
| macOS      | Fixed     |

With the default options, that becomes (· marks a space):

# Release notes
Version 2.1 fixes the export bug.··
Thanks to everyone who reported it!
|Platform|Status|
|---|---|
|Windows|Fixed|
|macOS|Fixed|

The file is 38% smaller. The first line of the paragraph keeps two spaces, because they make a line break. The second line loses its spaces, because there’s no line after it to break to.

How the render check works

Markdown is easy to break by accident. Trailing spaces can be a line break, a blank line can end a list, and a comment between two lists keeps them apart. Each of these looks like clutter, but removing it changes the page.

This tool reads your file the way a Markdown parser does. It knows which lines are code, which are tables and which are paragraphs, so it only edits what’s safe. Then it renders both your original and the compressed file and compares them. If they differ, you’ll see a warning with the exact spot, and a button to turn off the option that caused it.

It was tested on more than 1,600 real Markdown files, from READMEs to changelogs, plus 12,000 generated edge cases. Each result rendered the same in three different parsers: markdown-it, marked and micromark.

What’s never changed

  • Fenced and indented code blocks, including spaces and blank lines inside them
  • Inline code, so `a  b` keeps both spaces
  • HTML blocks like <details>, <div> and <pre>
  • Front matter, unless you choose to remove it
  • Your words, links, images, list markers and indentation
  • Tables with a | inside inline code, since Markdown parsers disagree on how to read them

Comments that are kept

Some comments do a job, so Remove comments leaves them in place and lists them above the result:

  • Excerpt markers like <!-- more --> (Jekyll, Hexo, Hugo) and <!-- truncate --> (Docusaurus)
  • Table of contents markers like <!-- toc -->, <!-- tocstop --> and doctoc blocks
  • Linter and formatter directives, like <!-- markdownlint-disable -->, <!-- prettier-ignore --> and cspell comments
  • Generated-content markers like <!-- ALL-CONTRIBUTORS-LIST:START -->
  • Empty <!-- --> comments, and any comment right after a list, since those are used to separate two lists or end a list before a code block

How much smaller will my file get?

It depends on how messy the file is. Hand-written notes, docs with lots of comments, and tables padded to line up often shrink by 10–30%. READMEs that already go through a formatter like Prettier are usually tidy, and might lose under 2%. That’s expected. Markdown has very little that can be removed without changing the page.

For a much bigger reduction, use the .gz download. GZIP typically makes Markdown 50–70% smaller, which is ideal for backups, archives and sending docs. Static site generators and GitHub can’t read a .gz file directly, though. Unzip it first (gunzip notes.md.gz on Linux and macOS, or 7-Zip on Windows), and use the regular .md download for files you’ll publish or commit.

Frequently asked questions

Will this change how my README looks on GitHub?

No. Everything the tool removes is invisible on the rendered page, and every result is checked by rendering it. If a file ever renders differently, the tool tells you and shows which option to turn off.

Why weren’t my trailing spaces removed?

Two or more spaces at the end of a line inside a paragraph create a line break. Removing them would join the two lines. The tool keeps them, marks them with dots in the result, and can swap them for a backslash if you prefer.

Does it work with Jekyll, Hugo and other site generators?

Yes. Front matter is kept by default, along with excerpt markers like <!-- more -->. Only turn on Remove front matter if the file won’t be built by a site generator.

Does it change anything inside code blocks?

No. Fenced and indented code blocks are left exactly as written, including trailing spaces and blank lines. A comment inside inline code, like `<!-- x -->`, is kept too, because it’s part of the code.

Can I get my comments back later?

No, removed comments are gone from the compressed file. Keep your original as the editable copy, and use the compressed version for publishing, storage or sharing.

Is my file uploaded anywhere?

No. The compressing, the render check, the preview and the GZIP step all run in your browser. Your Markdown never leaves your device. Only your option choices are remembered in your browser.

Compression Tool Library

Flipper File