📝 Text files
Plain-text test files
102,400 bytes
text/plain
104,857,600 bytes
text/plain
10,240 bytes
text/plain
10,485,760 bytes
text/plain
1,048,576 bytes
text/plain
About Text files
Plain-text files from 10 KB to 100 MB are available free, for verifying text processing, simulating log files, and checking how editors cope with large files.
Only two variables cause trouble in plain text: character encoding and newline convention. Files for each newline convention (LF, CRLF, CR, and mixed) are on the newline test page.
Typical uses
- Checking whether a text editor or viewer can open a large file at all
- Measuring how long a log-analysis tool takes
- Confirming the reader works line by line — slurping the whole file strains memory
- Benchmarking line and character counting
Related reference and articles
📖 Where people get stuck
Plain text from 10 KB to 100 MB, for timing reads and probing the limits of text handling. There is no such thing as a correct plain-text format. Encoding and line endings are information supplied from outside; the file never states them.
| Case | What happens | What to do |
|---|---|---|
| An invisible character starts the first line | A UTF-8 BOM (EF BB BF) does not render. The first key becomes id and only the comparison stops matching. |
Check with head -c 3 file | xxd. To drop it on read, compare the first three bytes in PHP, or use encoding="utf-8-sig" in Python, which handles it for you. |
| Different tools report different line counts | wc -l counts newline characters. Without a trailing newline the count is one short of what an editor shows. POSIX does expect a text file to end with one. |
Emit a trailing newline. Diffs come out clean and the counts agree. When mixed endings are the suspect, the line-ending test files show you how your tools behave. |
| Opening the 100 MB file kills the process | file_get_contents() and readlines() load the whole file. PHP default memory_limit does not cover a 100 MB input. |
Iterate a line at a time — fgets() in PHP, for line in f in Python. Once memory no longer scales with input size, you stop having to raise the limit. |
A text file never states its own encoding. Short of a BOM, every determination is a guess. For an import path, letting the user choose, or fixing it by agreement, ends up sturdier than any detection.