Turn a text file into a PDF

Puts every line of a .txt file onto pages in the order it is written, with long lines wrapped. Nothing is uploaded and no account is needed.

Drop your text file here or click to choose a file text file · processed on this device

TXT to PDF in three steps

A plain text file has no pages. It is a run of characters with line breaks, and every program that opens one decides for itself how wide the lines may be and where one page ends.

This makes those decisions and writes the result out. Each line of the file becomes a line on the page, blank lines stay blank, and a new page starts when the next line would run past the bottom margin. The text is set in Helvetica at body size, on A4, with a margin all round.

What is kept and what is not

The order of the lines, the blank lines between them and the words themselves are kept exactly. What is not kept is anything a plain text file cannot carry in the first place: there is no bold, no heading size and no colour to preserve, because the file never held any.

Two things change on the way in. A tab becomes four spaces, and spaces at the end of a line are dropped, since nobody can see them and they only make a line wrap early. Runs of spaces inside a line collapse to one when the line is wrapped, so text that was aligned into columns with spaces will not stay aligned.

If your file is Markdown, use Markdown to PDF instead, which reads the headings and lists. A .txt file put through a Markdown reader can change meaning, because a line that starts with a hash sign or an asterisk is read as structure. This tool reads nothing as structure.

Text saved by other programs

A .txt file does not say which encoding it was saved in. Most today are UTF-8, but older Windows programs saved single-byte text and some editors write UTF-16. The file is checked for both before it is read, so an accented letter or a curly quote arrives as itself and not as a run of odd characters.

Characters Helvetica cannot draw

The PDF is set in Helvetica, which every reader has and which covers Latin text and not much else. A character it cannot draw is replaced, and the result tells you how many were replaced rather than letting them vanish. If the text is in Hindi or Arabic, the font for that script is loaded for the job. Chinese, Japanese and Korean are not covered: each such character becomes a question mark, and the count is shown. Hindi and Arabic display correctly, but some viewers rebuild the text for copying and searching from the shapes on the page, and letters that share a shape, such as the Arabic letters that differ only by their dots, can come out as the wrong one. The words are also stored in the file as you typed them, which readers that honour that use.

When a PDF is the better copy

A text file opens differently on every machine, and some phones open it in whatever app claims it. A PDF looks the same wherever it is opened, so it suits notes you want to attach to an email, a log you want to hand to someone who has no editor, or a draft you want to keep exactly as it was on the day you sent it.

Nothing leaves the device

The file is read and the PDF is written by a worker inside your browser. There is no upload, no account and no server copy, and no request goes anywhere while it happens. That matters for the files people most often print from a text editor: notes, logs, drafts and pasted emails.

  1. 1

    Choose a .txt file

  2. 2

    Let the lines be laid onto pages

  3. 3

    Download the PDF

Frequently asked questions

Are the line breaks kept?

Yes. Each line of the file is a line on the page and each blank line is a blank line. A line longer than the page is wrapped onto the next line rather than cut off.

Does it read text saved by older Windows programs?

Yes. The file is not assumed to be UTF-8. It is checked for UTF-16 and for the older single-byte encodings, so an accented letter is read as the letter it was.

What happens to a tab?

It becomes four spaces. Columns lined up with tabs will not line up on the page, because the text is set in a proportional font.

How large a file can it take?

Up to 20,000 lines and up to 32 MB. Past that it is a log or an export rather than a document, and laying it out would take longer than the tab stays open.

Does the file leave my computer?

No. The file is read and the PDF is written by a worker inside your browser, with no upload, account or server copy.

Related guides

Counting and measuring a piece of writingCharacter counts differ because tools count different things, and readability scores measure sentence length, not clarity. What each number means.