SWISSARMY/PDF All tools
Convert

TXT to PDF

Convert TXT to PDF online

Drop a .txt file or paste text directly, then export a tidy PDF — your choice of font and page size.

Drop a .txt file
or paste text below
TEXT
HOW IT WORKS

How to txt to pdf

  1. 01

    Upload a TXT file or paste your text.

  2. 02

    Choose font, size, and page layout.

  3. 03

    Click Convert and download.

FAQ

Frequently asked

What encoding is supported? +
UTF-8. Other encodings should be saved as UTF-8 first.
Are files uploaded? +
Files never leave your browser — everything happens locally on your device.
Will it preserve indentation? +
Yes — spaces and tabs are kept as-is in the PDF.
GUIDE

Convert TXT to PDF — free, in your browser, no signup

Updated

TL;DR

Plain text files are everywhere but PDFs are universal. SwissArmyPDF turns any .txt file (or pasted text) into a clean, paginated PDF with your choice of font, page size, and layout. All in your browser — no upload, no watermark.

When you need TXT → PDF

  • Server logs. Share a snapshot with a teammate without sending a 10MB log file.
  • Code snippets. Export source code for documentation or print.
  • Configuration files. Archive an exact-state config in a non-editable format.
  • Notes and journals. Plain-text journal entries packaged into a sharable PDF.
  • Project Gutenberg books. Turn .txt downloads into readable PDFs.
  • Email content archives. Pasted email text as a permanent record.
  • Recipe and reference cards. Print-ready PDF from a plain text source.

How to convert TXT to PDF (step by step)

  1. Open TXT to PDF.
  2. Drop your .txt file or paste text directly.
  3. Pick a font family, size, page size, and orientation.
  4. Click Convert and download the PDF.

Pagination is automatic — long text wraps and breaks across pages.

Text encoding — what works

UTF-8 is fully supported. If your source file is in a different encoding (Windows-1252, ISO-8859-1, Shift-JIS), convert it to UTF-8 first:

  • Mac/Linux: iconv -f WINDOWS-1252 -t UTF-8 source.txt > out.txt
  • VS Code: bottom-right shows current encoding; click to "Save with encoding" → UTF-8.
  • Notepad++: Encoding menu → Convert to UTF-8.

Without proper UTF-8, accented characters and non-Latin scripts appear as mojibake (… etc).

What's preserved (and what isn't)

  • Spaces and tabs — preserved exactly. Use monospace fonts (JetBrains Mono, Courier) for code where alignment matters.
  • Line breaks — preserved.
  • Soft line wrap — long lines wrap automatically at the page edge.
  • No formatting — plain text has no bold, italic, or color, so neither does the PDF output. For formatted text from .rtf or .md, use RTF to PDF or Markdown to PDF.
  • No syntax highlighting — code blocks render in monospace but without color.

Tips for code-heavy text

  • Pick a monospace font — JetBrains Mono or Courier preserve alignment for code, ASCII art, tables.
  • Pick landscape orientation — code lines often exceed 80 characters; landscape avoids wrapping.
  • Use a smaller font size (8–10pt) for long files to keep page count down.
  • For syntax highlighting, paste the code into VS Code, export to HTML, then run through HTML to PDF — that's the cleanest path.

Troubleshooting

  • Characters appear as boxes or mojibake. Source file isn't UTF-8. Re-save as UTF-8 first.
  • Tab indentation collapsed. Use a monospace font and convert tabs to spaces (4 or 8) before importing.
  • Long lines wrap awkwardly. Switch to landscape, smaller font, or pre-wrap the source.
  • PDF is many pages from a short file. Check the font size — defaults are often too large for log output. Try 9pt.

Why local TXT-to-PDF matters

Plain-text files often contain things you wouldn't share: source code, server logs with internal hostnames or stack traces, config files with internal endpoints, personal journals. Uploading them to a web converter is a privacy hit. SwissArmyPDF runs conversion in your browser using pdf-lib. Nothing is uploaded; nothing is logged.

Common next steps

  • Merge PDF — bundle with other PDFs (cover, attachments).
  • Watermark PDF — mark as DRAFT or CONFIDENTIAL.
  • Sign PDF — sign for sign-off.
  • Markdown to PDF — if your source has any structure (headings, lists, code blocks), use markdown instead.
RELATED

More convert tools