Skip to main content
FormatDrop
How-To Guide

How to Convert TXT to PDF

Plain text files (.txt) contain no formatting instructions, which makes them awkward to share or print professionally. Converting TXT to PDF wraps the text in a clean, printable layout with consistent margins, font, and page breaks. The result is a shareable document that looks the same on every device.

Method 1: Convert TXT to PDF online (free, in your browser)

  1. 1

    Open the TXT to PDF converter

    It runs in your browser tab, so the text never leaves your device.

    Go to converter
  2. 2

    Add the text file

    Drop a .txt file on the page. Free: 2 files a day, up to 10 MB each. Pro: no daily limit, files up to 500 MB.

  3. 3

    FormatDrop lays out the pages

    The PDF uses A4 pages and a 10-point monospace font (Liberation Mono). Long lines wrap at word boundaries, tabs line up on 8-column stops, and the file is read as UTF-8, falling back to Windows-1252 for older files. Latin, Greek and Cyrillic text works; Chinese, Japanese, Arabic and emoji aren't supported.

  4. 4

    Download the PDF

    The text in the PDF can be selected and copied. PDF output has no watermark.

Other ways to convert TXT to PDF

  1. 1

    Print to PDF (any computer)

    Open the .txt file in a text editor (TextEdit, Notepad, gedit) and print it. Choose 'Microsoft Print to PDF' as the printer on Windows, or PDF → Save as PDF in the Mac print dialog.

  2. 2

    LibreOffice (free)

    Open the file in LibreOffice Writer. For code or logs, pick a monospace font first. Then File → Export as PDF. From the command line: soffice --headless --convert-to pdf input.txt.

  3. 3

    enscript + Ghostscript (command line)

    enscript -p output.ps input.txt && ps2pdf output.ps output.pdf. enscript adds a header with the file name and page number; add -B to leave it out.

Why convert TXT to PDF?

Plain text is the most portable format for content; PDF is the most portable format for presentation. Converting TXT to PDF gives your text a home that looks professional and prints correctly everywhere.

Your files never leave your device

FormatDrop runs the conversion engine entirely inside your browser using WebAssembly. No file upload. No server. Nothing stored. You can verify this by opening DevTools → Network tab and watching: zero upload requests.

Frequently asked questions

How do I convert TXT to PDF on the command line?
Using enscript and Ghostscript: `enscript -p output.ps input.txt && ps2pdf output.ps output.pdf`. Using pandoc: `pandoc input.txt -o output.pdf`. Using LibreOffice: `soffice --headless --convert-to pdf input.txt`. On a Mac, `cupsfilter input.txt > output.pdf` works without installing anything.
Will the PDF wrap long lines properly?
It depends on the converter. Most tools set a fixed line width and wrap at word boundaries. If your TXT has very long lines (e.g., log files), choose a monospace font and a smaller font size (8–9pt) so each line fits within the page width.
Can I preserve code formatting when converting TXT to PDF?
Use a monospace font like Courier New or Consolas and disable word-wrap (preserve line breaks). For syntax colours, wrap the code in a Markdown fenced block with a language tag (```python) and run pandoc on that file with --highlight-style=tango. A plain .txt file gets no highlighting.
Convert TXT to PDF Now — Free

No account. No upload. Works in any browser.