Or paste LaTeX source

Remove comments from LaTeX files without changing the output

LaTeX source files collect comments: notes to co-authors, old paragraphs commented out, reviewer replies, and to-do lists. That's fine while you write, but before you submit, share, or archive the source, you usually want them gone. They make files bigger, and they can reveal things you'd rather keep private. This tool strips comments and redundant whitespace from .tex files while keeping the compiled document exactly the same.

Everything runs in your browser. Your manuscript never leaves your computer.

Removing comments before an arXiv submission

arXiv makes the LaTeX source of most papers publicly downloadable, comments included. Comments like "% Reviewer 2 is wrong about this" or a commented-out section with unpublished results become public along with the paper. arXiv itself recommends removing comments before you submit. Process every .tex file in your project here, then upload the cleaned files.

How to use it

  1. Choose your .tex files (the main file plus any chapters you \input), or paste source text.
  2. Adjust the options. The defaults are safe for any document.
  3. Check the results: bytes saved, the verification badge, and the list of every comment that was removed.
  4. Download each file, or the whole project as a ZIP.

Why careless comment removal breaks LaTeX

In LaTeX, a % doesn't just start a comment. It also swallows the line break after it, and that matters. Many macros put a % at the end of a line specifically so that no stray space appears in the output:

\newcommand{\product}{Flipper%
  File}             % prints "FlipperFile", with no space

Delete that % and you get "Flipper File" instead. This tool keeps a % whenever it's doing that job, and removes only the comment text after it. It also knows where a % isn't a comment at all:

SituationExampleHandled as
Escaped percent sign50\% offText, kept
Line break before a commentlast row \\% noteComment removed, line break kept
Inline verbatim\verb|a % b|Kept exactly
URLs\url{https://x.com/a%20b}Kept exactly
Code listings and verbatim blocksverbatim, lstlisting, mintedKept exactly, including spacing
Magic comments% !TEX program = xelatexKept (optional)

Blank lines work the same way. One blank line starts a new paragraph, so tools that remove all blank lines merge paragraphs together. This one only collapses runs of blank lines into one, which produces the same output.

How it's checked

Every result is checked automatically. The tool strips the comments and whitespace from both the original and the cleaned file in a separate pass, then compares what remains. The green Verified badge means the actual LaTeX code is unchanged. During development, cleaned files were also compiled with pdflatex and compared page by page with the originals, including documents with hundreds of randomly inserted comments. Every compiled page was pixel-identical.

If a file changes how % works with \catcode, the tool can't safely tell comments from text, so it leaves the file unchanged and tells you why.

Frequently asked questions

Will my document compile exactly the same?

Yes. Only comments and whitespace that TeX ignores are removed, and the code itself is verified as unchanged. Removing \iffalse blocks is optional and off by default.

Are my files uploaded?

No. Everything happens in your browser, which matters for unpublished research.

Does it work with Overleaf projects?

Yes. Download your project from Overleaf (Menu, then Download as source), add the .tex files here, and upload the cleaned files back or submit them directly.

What about .bib files?

BibTeX files use different comment rules, so they're left out. Unused bibliography entries never appear in the compiled paper anyway.

Can I see what was removed?

Yes. Each file lists every removed comment with its line number, and you can preview the cleaned source before downloading.

Will it shrink my file a lot?

Heavily commented drafts often shrink 20 to 40 percent. For sharing a large project, the ZIP download compresses everything further.

Compression Tool Library

Flipper File