This TXT to PDF converter turns a plain-text file or pasted text into a previewed PDF in your browser. It gives you direct control over character encoding, paper, margins, font, line spacing, tabs, long-line wrapping, line numbers and page footers before the document is downloaded.
Plain text has no built-in page size, font, margins or reliable visual layout. A .txt file is a sequence of characters and line breaks, so converting it to PDF requires real decisions about how those characters should be decoded and how the lines should fit on fixed pages. This page keeps those decisions visible instead of silently applying one template.
The practical goal is not merely to change the filename extension. It is to produce a PDF whose characters are readable, whose indentation still makes sense, whose long lines do not disappear unexpectedly and whose page count matches the content you intend to share.
How to convert TXT to PDF online free
- Upload a TXT file or paste text. The current file limit is 5 MB. Direct text entry supports up to 500,000 decoded characters.
- Check the encoding. Auto detect checks common byte-order marks, probable UTF-16 patterns and valid UTF-8. If that result looks wrong, select an encoding manually and the original file will be read again.
- Edit the text if necessary. Changes in the editor affect the PDF source but do not modify the original file on your device.
- Choose paper, orientation and margins. Use A4, US Letter or US Legal in Portrait or Landscape.
- Choose the font and spacing. Select sans serif, serif or monospace, then set font size, line spacing and tab width.
- Choose reading aids. Wrap long lines, add source line numbers and include a footer with the source label and PDF page number.
- Inspect the planned pages. The page count and first four page thumbnails update from the current text and controls.
- Read any warning. Replacement characters, hidden control characters, an encoding fallback or possible long-line clipping deserve review.
- Create and inspect the PDF. The result panel displays the actual generated PDF, document statistics and the settings used for the output.
- Download the file. Open the downloaded PDF separately before submitting or sharing it.
This is an online TXT to PDF converter because it runs on a web page, but the current conversion workflow stays in the browser. The text is decoded, edited, paginated, rendered and assembled into a PDF without a base97 file-conversion endpoint or a required account.
Upload a file or paste text
The editor supports two related tasks.
Convert a TXT file to PDF
Choose or drop one file ending in .txt. The page keeps the original bytes in browser memory so you can try another character encoding without selecting the file again. The decoded text appears in the editor and can be reviewed before conversion.
The tool does not treat every text-like file as TXT. Markdown, CSV, source-code, log and configuration files may contain plain text, but their extensions and semantics describe different tasks. You can paste their text into the editor when appropriate, but the upload picker currently accepts .txt as the explicit supported file format.
Convert pasted text to PDF
You can skip the file picker and type or paste directly. Pasted text already exists as browser Unicode, so there are no source bytes for the encoding selector to reinterpret. Page layout, statistics, wrapping, line numbers and PDF generation work the same way.
The editor reports characters, words, source lines and planned pages. These counts help identify accidental truncation. If the source has 800 lines but the editor reports 80, stop and check the file or encoding before creating the PDF.
The page preserves blank lines and ordinary spaces. Tabs are expanded according to the selected tab width when the page layout is calculated. Editing the text can therefore change wrapping and page count even when only whitespace changes.
Choose the correct text encoding
Character encoding determines how file bytes become letters, punctuation and symbols. The same byte sequence can produce different characters under different encodings, so an incorrect choice can create mojibake, question marks or the Unicode replacement character �.
Auto detect follows a conservative sequence:
- A UTF-8 byte-order mark selects UTF-8.
- A UTF-16 little-endian or big-endian byte-order mark selects the matching UTF-16 decoder.
- A strong alternating-zero pattern can indicate UTF-16 without a byte-order mark.
- Otherwise the bytes are validated as UTF-8.
- If strict UTF-8 validation fails, the page uses Windows-1252 as a visible fallback and asks you to inspect the result.
That fallback is not a guarantee. Automatic encoding detection is inherently ambiguous when a file has no declaration or byte-order mark. The page therefore provides manual choices for UTF-8, UTF-16 little-endian, UTF-16 big-endian, Windows-1252, Windows-1251, GB18030/GBK, Big5 and Shift JIS.
The browser decoding step uses the standard TextDecoder interface documented by MDN. Actual decoder availability depends on the browser, although current mainstream browsers generally expose the encodings used by this page.
Use the warning panel together with visual review:
- Replacement characters: one or more byte sequences could not be represented cleanly under the selected decoder.
- Fallback encoding: the bytes were not valid UTF-8 and no BOM identified another encoding.
- Unexpected scripts or punctuation: the decoder produced valid characters, but likely not the intended ones.
- Missing symbols: a font may not contain a glyph even when decoding was correct.
Changing the encoding re-reads the original uploaded file. It replaces edits currently visible in the editor, so choose the encoding before making substantial text changes.
Set paper, font and line spacing
TXT has no native page setup. The controls on this page define the document that will be created.
Paper and orientation
| Setting | Practical use |
|---|---|
| A4 | International documents, notes and reports |
| US Letter | Everyday documents in the United States |
| US Legal | Taller pages for long notes or records |
| Portrait | Ordinary prose and narrow text |
| Landscape | Logs, tables and long technical lines |
Margins change the width available for every line. Narrow margins fit more characters and lines per page. Wide margins create more whitespace but can increase page count and line wrapping.
Font family
Sans serif is the default for general reading and interface-style notes. Serif can suit longer prose. Monospace gives each character a consistent advance and is usually the better choice for source code, logs, aligned columns, terminal output or text diagrams.
The renderer uses browser font stacks rather than embedding one guaranteed font file. A different operating system can choose a different installed fallback, especially for CJK, Arabic, Devanagari or uncommon symbols. The page preview is therefore the evidence for the current device.
Font size and line spacing
A smaller font produces fewer pages but can make dense text difficult to read. A larger font improves screen and print readability but wraps sooner. The current choices run from 9 to 18 points.
Line spacing ranges from compact to wide. Use compact spacing for logs or reference material and more open spacing for prose that will be read continuously. Page count updates so the tradeoff is visible before conversion.
Wrap long lines, tabs and line numbers
Long lines are common in logs, exported records, URLs and source code. A fixed PDF page cannot display unlimited width.
With Wrap long lines enabled, the planner measures the selected browser font and splits lines to fit the printable width. It prefers whitespace when a useful break point exists and otherwise breaks a long token by character. Wrapped continuations do not receive a new source line number.
With wrapping disabled, each source line remains one visual line. Text that exceeds the printable width is clipped. This can be useful only when preserving one-line-per-record structure matters and you have already chosen Landscape, a small font and suitable margins. The tool warns when the longest source line creates an obvious clipping risk.
Tabs are expanded to 2, 4 or 8 spaces. This preserves predictable indentation but does not reproduce application-specific tab stops or proportional-column layouts. Monospace text gives the most stable visual alignment.
Optional line numbers refer to original source lines, not wrapped visual lines. This is useful when a recipient needs to discuss a log or text extract by line. Page numbers are separate: the footer shows the source label on the left and PDF page number on the right.
Check the generated PDF
Review the output in two passes.
First, inspect the PDF pages:
- Confirm the first and last lines are present.
- Check non-ASCII names, punctuation and symbols.
- Inspect indentation, tabs and blank lines.
- Look at the longest source lines.
- Confirm line numbers still match the source.
- Check the footer does not compete with the final content line.
- Compare the generated page count with the planned count.
Then read the result report:
- File size reports the actual generated PDF and uploaded TXT size when a file was used.
- Document confirms the PDF metadata title and source label.
- Text statistics reports characters, words, source lines, wrapped lines and blank lines.
- Source encoding records how the uploaded file was decoded and reports replacement or control characters.
- Page setup records paper, orientation, margins and footer status.
- Typography records font, size, spacing, tab width and wrapping behavior.
- Reading aids confirms line-number and rendering choices.
The report is not a semantic accuracy score. Correct UTF-8 can still contain the wrong source text, and zero replacement characters do not prove that the chosen legacy encoding was intended. Visual comparison remains necessary.
Illustrative TXT to PDF examples
Convert a UTF-8 meeting note
Assume meeting-notes.txt contains ordinary paragraphs and bullet-like lines. Upload it, keep Auto detect, choose A4 Portrait, Sans serif, 11 pt and Comfortable spacing. Keep wrapping and the page footer on. The planned thumbnails should show natural paragraph wrapping without source line numbers.
Convert a server log
Assume a log contains timestamps, identifiers and long request paths. Choose Landscape, Narrow margins, Monospace, 9 or 10 pt, 4-space tabs and source line numbers. Keep long-line wrapping on unless one-line-per-event structure is more important than showing every character.
Repair a legacy Windows text file
Assume a file shows accented names incorrectly under Auto detect and reports a Windows-1252 fallback. Compare Windows-1252 with UTF-8 manually. Keep the version that shows the intended characters and produces no unexplained replacement symbols.
Illustrative examples. Actual page count, file size, line wrapping, glyph coverage and processing time depend on the text, selected fonts and browser.
Scope, alternatives and honest limits
Established tools cover related upload-and-convert workflows. Adobe Acrobat connects document conversion to a broader PDF product. Smallpdf offers cloud PDF conversion and follow-up actions. PDF24 provides browser and desktop PDF utilities. Their account, upload, storage and conversion behavior can differ from this page and may suit users who need a broader cloud workflow.
The specific base97 difference is the combination of editable source text, visible encoding decisions, text diagnostics, page planning, typography controls, long-line behavior, line numbers and an actual PDF preview in one local browser workflow. This does not make base97 universally better; it makes the workflow more inspectable for plain text.
The limits are explicit. The current tool accepts one local .txt file or pasted text. It does not parse Markdown into styled headings, detect programming languages, add syntax highlighting, convert HTML, preserve rich-text spans, import URLs, merge multiple TXT files or fetch cloud documents.
The generated PDF stores rasterized page images. It does not create selectable or searchable text, tagged accessibility structure, clickable links, bookmarks, annotations, forms, attachments, encryption, PDF/A, digital signatures or OCR.
Use a word processor, Markdown editor, code-printing tool or a converter that explicitly embeds Unicode fonts when selectable text, semantic headings, syntax colors, live links or accessibility tags are required. For an existing Word document, use the Word to PDF converter. For tabular Excel content, use the Excel to PDF converter.
Troubleshoot TXT to PDF problems
The TXT file is rejected
Confirm the filename ends in .txt and the file is no larger than 5 MB. A renamed binary file is not valid plain text and may decode into control characters or replacement symbols.
Characters look corrupted
Try another source encoding. UTF-8 is the modern default, but older files may use Windows-1252, Windows-1251, GB18030, Big5 or Shift JIS. Inspect names and punctuation rather than relying only on the absence of an error.
The page reports replacement characters
The selected decoder encountered byte sequences it could not map cleanly. Choose the correct encoding or open and resave the file as UTF-8 in a trusted text editor before conversion.
The line count looks wrong
Mixed CRLF, LF and CR line endings can indicate content assembled by several systems. The tool normalizes them for layout but reports the source style. Confirm that visible paragraph and record boundaries are correct.
Long lines are cut off
Enable Wrap long lines, switch to Landscape, use Narrow margins, reduce the font size or choose Monospace. When wrapping is disabled, clipping is expected for text wider than the printable area.
Columns no longer align
Choose Monospace and the correct tab width. Plain text alignment based on tabs or repeated spaces is not reliable in a proportional font.
Some symbols appear as empty boxes
The current browser font fallback may not contain those glyphs. Try Sans serif or Serif, install a suitable system font, or use a document workflow that embeds the required font.
The PDF is too large
Choose Standard rendering detail and Balanced PDF. Crisp text uses PNG page images and often produces a larger result, especially across many pages.
The PDF text cannot be selected
That is expected in the current implementation. Each page is rendered as an image. Use a text-aware PDF creator when search, selection, copying or accessibility is required.
TXT to PDF FAQ
Is this TXT to PDF converter free and available online?
Yes. The current base97 page does not require payment or an account. You can upload one TXT file within the displayed limits or paste text directly into the editor.
Can I convert pasted text without uploading a file?
Yes. Type or paste text into the editor, choose the page and typography settings, inspect the planned pages and create the PDF. Encoding controls apply only to uploaded file bytes.
Why does my TXT file show strange characters?
The selected character encoding may not match the file. Try UTF-8, UTF-16, Windows-1252, Windows-1251, GB18030, Big5 or Shift JIS, then inspect the replacement-character warning before conversion.
Can the PDF preserve code or log indentation?
The tool preserves spaces, expands tabs to the selected width and offers a monospace font and line numbers. Long lines can wrap, or they can remain on one line and be clipped at the page edge.
Is the PDF text selectable?
No. The current browser workflow rasterizes each page and stores it as an image in the PDF. Use a document editor or a converter that explicitly creates a Unicode text layer when selectable or accessible text is required.
Research and editorial notes: Tool scope and behavior were checked against the base97 implementation on October 2, 2026. Encoding behavior uses the browser TextDecoder API. Competitor references use official product pages to compare workflow scope, not to claim universal rankings or guaranteed superiority.