TXT to PDF
Convert a plain-text (.txt) file into a downloadable PDF. Paste text or upload a file, choose a page size, font and margins, and convert entirely in your browser — nothing is uploaded.
Input
Read as UTF-8 text and dropped straight into the box above.
White space around the text, in points (72 pt = 1 inch).
Collapse hard line breaks within a paragraph and re-wrap the text cleanly — useful for files hard-wrapped at a fixed column. Leave unchecked to keep every line break exactly as typed.
Output
Guides
Turn plain text into a real PDF you can share, print or archive. Paste text or
upload a .txt file, pick a page size, font and margins, and download the
result — all in your browser.
How to use it
- Paste your text into the box, or drop a .txt file to load it there.
- Open Page options to set the page size, orientation, font, font size and margin.
- Turn on Reflow into paragraphs if the file was hard-wrapped at a fixed column (common in old emails and plain-text exports) — it collapses those mid-paragraph line breaks and re-wraps the text cleanly. Leave it off to keep every line break exactly where it was typed.
- Press Convert to PDF, then download
document.pdf.
Free in your browser, private by default
The PDF is built entirely on your device — your text is never uploaded. There's no file-size limit beyond what your browser can hold in memory, and long documents automatically flow across as many pages as they need.
What happens to tabs and Windows line endings?
Tabs are expanded to spaces and \r\n/\r line endings are normalized to
\n before layout, so files exported from Windows or containing tab-indented
text lay out the same as anywhere else.
Should I turn on "Reflow into paragraphs"?
Only if your file uses hard line breaks inside paragraphs — text that was manually wrapped at, say, 72 characters per line. Reflowing collapses those breaks and re-wraps the paragraph to fit the page, so it reads like a normal document instead of a ragged column. For code, ASCII art, or anything else where exact line breaks matter, leave it off (the default) — every line is kept as-is and only wrapped if it's too wide for the page.
Is there an API?
Yes. The same tool is available as a developer API
(POST /v1/tools/txt-to-pdf) for converting text from a script or backend.
Send the text as a string; the response carries the PDF as a data URL. The
in-browser tool on this page stays free.
I need to combine images or an Office document into a PDF instead
For images, use Image to PDF to combine PNG/JPEG files into one PDF. For Word documents, use Word to PDF, which preserves formatting and layout.
Use it from code
From 3 credits per callREST API
curl -X POST https://api.iotools.cloud/v1/tool/txt-to-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, world!\n\nThis plain-text file has just bee…",
"pageSize": "a4",
"orientation": "portrait",
"font": "helvetica",
"fontSize": "12",
"margin": "40",
"reflow": ""
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `txt-to-pdf` tool (TXT to PDF) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.