A plain text file being converted into a formatted PDF document on a laptop screen

How to Convert a TXT File to PDF

A plain, step-by-step guide to turning any text file into a clean PDF, with fixes for the line-break and encoding issues that usually go wrong.

To convert a TXT file to PDF, open the text file and either print it to PDF or upload it to an online converter, then download the result. On Windows or Mac, open the .txt file, choose Print, and pick "Save as PDF." Online tools do the same in your browser, with nothing to install.

That is the short version. But a text file carries almost no formatting, so the way you convert it decides whether the PDF looks tidy or like a wall of cramped, wrapped lines. Below are the exact steps for every common method, plus the small things that quietly go wrong, so you end up with a PDF you would actually want to send.

Key takeaways

  • The fastest method is "Print to PDF," built into Windows, macOS, and most browsers, with no install required.
  • Online converters help when you want consistent margins and font sizing without fiddling with print settings.
  • The usual failure points are encoding (special characters turning into question marks) and line breaks (long lines getting chopped awkwardly).
  • A .txt file has no fonts, colors, or layout of its own, so the converter chooses all of that, and you can usually adjust it.
  • For anything you will edit later, convert first, then open the PDF in an editor to add headings, page numbers, or spacing.

What actually happens when you convert TXT to PDF

A .txt file is about as simple as a document gets: it is just characters, with no font, no margins, no page size, and no styling. A PDF, by contrast, is a fixed-layout format that pins every character to a precise spot on a page. So converting one to the other is not really a "translation," it is the converter deciding how to lay out your plain text: which font, what size, how wide the margins, where one page ends and the next begins.

That is worth knowing because it explains every quirk you will run into. If your lines wrap strangely, that is the layout engine fitting long lines to the page. If a special character shows up as a box or a question mark, that is an encoding mismatch. None of it means your text file is "broken." It is just plain text meeting a format that demands decisions plain text never had to make.

PDF has been around since 1993, when Adobe released version 1.0 out of John Warnock's "Camelot" project, and it became an open ISO standard (ISO 32000-1) in 2008. Decades of refinement are part of why a humble .txt file lands so reliably as a PDF today.

Two invisible details shape the result more than anything else. The first is the encoding, which is how the file maps its bytes to letters and symbols. The second is the line endings, the hidden characters that mark where each line stops; Windows and Mac historically wrote those differently, and a converter that misreads them can run two lines together or leave odd gaps. You rarely have to touch either by hand, but knowing they exist is half the battle when something looks off.

Method 1: Print to PDF (Windows, Mac, and browsers)

This is the simplest route and it is already on your computer. "Print to PDF" takes whatever is on screen and saves it as a PDF instead of sending it to a printer.

On Windows

  1. Open your .txt file by double-clicking it (it opens in Notepad by default).
  2. Press Ctrl + P, or go to File > Print.
  3. In the printer dropdown, choose Microsoft Print to PDF.
  4. Click Print, pick a folder, name the file, and save.

A quick tip: before printing, open Format > Word Wrap in Notepad and turn it on, then check File > Page Setup to set sensible margins so long lines do not run off the edge. Notepad also lets you change the display font under Format > Font, which carries through to the printed page.

On Mac

  1. Open the .txt file (it opens in TextEdit).
  2. Press Cmd + P, or choose File > Print.
  3. Click the PDF dropdown in the bottom-left of the print dialog.
  4. Choose Save as PDF, name it, and save.

If TextEdit opens the file in rich-text mode, switch to Format > Make Plain Text first so you are printing the raw text, not a styled version of it.

In a browser

  1. Drag the .txt file onto an open browser tab (Chrome, Edge, and Firefox all work).
  2. Press Ctrl + P (or Cmd + P on Mac).
  3. Set the destination to Save as PDF.
  4. Save.

The browser route is handy: it wraps long lines to the window width automatically and shows a live preview, so you can spot trouble before you commit.

The realistic failure mode: Print-to-PDF uses your current view settings, so if word wrap is off, long lines get clipped at the page edge and the cut-off text simply disappears from the PDF. Always confirm word wrap is on and preview before saving. Check the page count too; a file that looks short on screen can balloon into dozens of pages if the font is large or the margins are wide.

Method 2: Use an online TXT to PDF converter

If you would rather not wrestle with print dialogs, an online txt to pdf converter gives a cleaner, more predictable result. You upload the file, the tool applies sensible margins and a readable font, and you download the PDF. Nothing to install: a server handles the layout, then returns the finished file without keeping it long-term.

Here is the general flow with our online PDF editor:

  1. Open the editor or converter page in your browser.
  2. Upload or drag in your .txt file.
  3. Wait a moment while the text is laid out into pages.
  4. Preview the result, then adjust font size or margins if the tool offers it.
  5. Download the finished PDF.

This route shines when you have a long text file, because a good converter handles pagination automatically: it flows your text across as many pages as needed, with consistent margins on each. With Print to PDF you sometimes have to fight the page breaks; online, it is usually handled for you.

It is also better when you care about the PDF looking the same on every device. Print settings vary from one computer to the next, but an online converter applies the same layout rules every time, so the file you send looks identical to the one a colleague opens.

Which method should you use?

Neither method wins every time. Reach for Print to PDF when you need a fast result, when the file is short, or when the document is sensitive enough that you would rather not upload it; it stays on your own machine and needs no setup. Reach for an online converter when you want clean, repeatable margins, automatic page breaks for a long file, or a PDF that looks identical to everyone you send it to. The honest trade-off is convenience versus control: print-to-PDF is instant but leans on your local settings, while an online tool adds an upload step in exchange for consistent, hands-off layout.

Method 3: Convert and then edit for a polished result

Plain text has no headings, no bold, and no page numbers to guide a reader's eye. If your file is more than a quick note, say a report, a story, or meeting notes you will share, convert it first, then open the PDF in an editor to dress it up.

After converting, you can:

  • Add a title or headings so the document has structure.
  • Insert page numbers for anything longer than a page.
  • Adjust spacing and margins so it does not feel cramped.
  • Drop in a logo or signature if it is going to someone official.

Think of the conversion as step one and the editing as step two. The conversion gets your words onto pages reliably; the editing makes those pages look intentional rather than dumped.

How do I turn a text file into a PDF the fast way?

If you just need it done in under a minute and do not care about styling, use Print to PDF. Open the .txt, press Ctrl + P (or Cmd + P), choose "Save as PDF" or "Microsoft Print to PDF" as the destination, and save. That is the whole process. Reach for an online converter only when you want cleaner margins, automatic pagination, or a result that looks identical everywhere.

Common problems and how to fix them

Special characters turn into boxes or question marks. This is an encoding mismatch. Plain text files can be saved in different encodings (UTF-8, ANSI, and others), and if the converter reads the wrong one, accented letters, em dashes, and symbols garble. The fix: re-save your .txt as UTF-8 before converting. In Notepad, use File > Save As and pick UTF-8 from the encoding dropdown near the Save button.

Long lines get cut off. The text runs past the right margin and the overflow vanishes. Turn on word wrap before printing, or use an online converter, which wraps lines to the page width automatically.

Lines run together or there are odd blank gaps. This is usually a line-ending mismatch, common when a file written on one operating system is opened on another. Opening the file in a more capable editor and re-saving it often normalizes the line breaks; an online converter typically handles the difference for you.

Everything is one giant block with no spacing. Text files do not carry paragraph styling, so the converter pours the lines straight down. If you want breathing room, convert first, then add spacing and headings in an editor.

The font looks plain or too small. A .txt file has no font of its own, so the converter picks one, often a basic monospace or system font. Many online tools let you choose a font and size before downloading; if yours does not, edit the PDF afterward.

Text is not the only plain-format file people convert to PDF. If you write in Markdown, the steps and gotchas are similar but worth their own walkthrough, see how to convert a Markdown file to PDF. And if you are going the other direction, pulling clean, editable text back out of a PDF, how to convert a PDF to Markdown covers that round trip. Together they round out the plain-text-to-PDF-and-back workflow.

FAQ

How do I turn a text file into a PDF?

Open the .txt file, press Ctrl + P (Windows) or Cmd + P (Mac), and choose "Save as PDF" or "Microsoft Print to PDF" as the destination, then save. That is the quickest way and it needs no extra software. If you would prefer cleaner margins and automatic page breaks, upload the file to an online txt to pdf converter instead.

Can I convert a TXT to PDF for free?

Yes. Both the print-to-PDF method and most online converters are free. Windows, macOS, and modern browsers all include a built-in "Save as PDF" option, so you do not need to buy or install anything to get a basic, readable PDF from a text file.

Will my formatting stay the same after converting?

A plain text file has almost no formatting to keep, just the characters and line breaks. The converter chooses the font, size, and margins, so the PDF will usually look tidier than the raw text. If you want specific styling like headings or page numbers, convert first, then add it in a PDF editor.

Why do special characters look wrong in my PDF?

That is almost always an encoding problem. If your text file uses one character encoding and the converter assumes another, symbols and accented letters can turn into boxes or question marks. Re-save the .txt as UTF-8 before converting, and the characters should display correctly.

Is it safe to use an online converter for my text file?

It is reasonable for everyday files. With our editor, your file is processed on a server and returned to you, not stored long-term. As with any online tool, avoid uploading highly sensitive documents you are not comfortable sending over the internet, and prefer the built-in print-to-PDF method for those.

What is the difference between converting TXT and Markdown to PDF?

A .txt file is pure plain text with no styling cues, so the converter handles all the layout. Markdown includes lightweight formatting marks (like # for headings and ** for bold) that a good converter turns into real headings and emphasis. The result is that Markdown-to-PDF can preserve more structure automatically.

Usama Ramzan
Written byUsama RamzanFounder, Online PDF Edits

Usama Ramzan is the founder of Online PDF Edits, a browser-based PDF editor built to change text, images, and tables in existing PDFs without breaking their fonts, spacing, or multi-page layout. He writes about practical PDF editing, document workflows, and the engineering behind layout-safe editing.

Recommended reading

View all articles →