Test files › Documents › very-long-single-line.txt

Text file with one very long line

A single line of 1,000,000 characters with no newline anywhere in the file.

↓ Download very-long-single-line.txt
Filenamevery-long-single-line.txt
FormatTXT
Size1000 KB (1,024,000 bytes)
MIME typetext/plain; charset=utf-8
SHA-256c51ef575b90527d834c783bc9a303383b421e84e7d885c225e2eaa3e59768754
What this file catchesLine-buffered readers that allocate unboundedly, editors that hang, and log shippers with a per-line size cap that silently truncate.

Handle it in code

Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.

Python

Read the bytes, not text mode, so the line endings survive to be counted. Invisible format characters (category Cf: zero-width spaces, direction overrides, the BOM) are the ones that make two identical-looking strings compare unequal.

import unicodedata

with open("very-long-single-line.txt", "rb") as f:
    data = f.read()
crlf = data.count(b"\r\n")
lf, cr = data.count(b"\n") - crlf, data.count(b"\r") - crlf
print(f"line endings: {crlf} CRLF, {lf} LF, {cr} bare CR")
print("ends with a newline" if data.endswith(b"\n") else "no newline at the end of the file")
text = data.decode("utf-8")
print(f"longest line: {max(map(len, text.splitlines()), default=0):,} characters")
hidden = sorted({f"U+{ord(c):04X} {unicodedata.name(c, '?')}" for c in text if unicodedata.category(c) == "Cf"})
print("invisible characters:", ", ".join(hidden) if hidden else "none")

Run against this file, it prints: line endings: 0 CRLF, 0 LF, 0 bare CR no newline at the end of the file longest line: 1,024,000 characters invisible characters: none

Related guides and tools

Sample TXT and encoding test filesCharacter encodingsVerify its SHA-256

Download & verify

curl -fsSL -o "very-long-single-line.txt" "https://files.hexaqa.com/text/very-long-single-line.txt"
curl -fsSL "https://files.hexaqa.com/text/very-long-single-line.txt" | sha256sum # expect: c51ef575b90527d834c783bc9a303383b421e84e7d885c225e2eaa3e59768754

More documents test files

utf16be.txtutf16le.txtutf8-no-bom.txtutf8-with-bom.txtzero-width-and-rtl.txtcorrupt-xref.pdfempty-zero-pages.pdfno-text-layer.pdf

← All Documents files