2 MB TXT sample file
A TXT file of exactly 2,097,152 bytes. It is a valid Plain text file, generated for this site and checked with an independent parser. Use it wherever you need a 2 MB sample, test or dummy TXT file.
Download
sample-txt-2mb.txt
2 MB2,097,152 bytes
Download 2 MB TXTDirect download. No sign-up and no waiting.
- Type
- text/plain
- SHA-256
f86d06525c44a368cc8587b9bd1e6c654a0fb44710371b8091c6ea5d1524cf66- Direct URL
https://sampletestfiles.com/downloads/txt/sample-txt-2mb.txt
What is in this file
21,096 numbered lines of plain English text, each prefixed with its line number and starting byte offset so truncation is easy to spot. A closing rule of "=" characters brings the file to the exact size.
| Numbered lines | 21,096 |
|---|---|
| Encoding | UTF-8 (ASCII characters only) |
| Line endings | LF (Unix) |
How the file begins
The opening lines of sample-txt-2mb.txt, exactly as they appear in the file.
SampleTestFiles sample text file (2 MB)
Encoding: ASCII, which is also valid UTF-8. Line endings: LF.
Each numbered line starts with its line number and the byte offset at which it begins.
0000001 000000190 This sample file exists so that software can be tested with realistic input.
0000002 000000285 Every line in this document was generated by a script and describes nothing confidential.
0000003 000000393 Use it to check that uploads, downloads and parsers behave the way you expect.
0000004 000000490 The file was built to an exact byte count, which makes size limits easy to verify.
0000005 000000591 If the last line of this file is missing, the transfer was cut short.
0000006 000000679 A good test fixture is boring, predictable and identical every time it is downloaded.
0000007 000000783 Compare the checksum published on the download page with the one you compute locally.Preview
Shows the first 64 KB of the file.
Where 2 MB matters
A 2,097,152-byte file: exactly the default upload limit of PHP, and twice the default of nginx and Spring Boot. These are the default limits a file of this size is useful for testing:
| System | Limit | Note |
|---|---|---|
| PHP | 2 MB per uploaded file by default (upload_max_filesize) | A file of exactly 2 MB is accepted; one byte more is refused. |
| nginx | 1 MB by default (client_max_body_size) | Rejected with 413 Request Entity Too Large. |
| Spring Boot multipart | 1 MB per file by default (max-file-size) | Rejected unless the property is raised. |
| Django | 2.5 MB in memory by default | 2 MB is held in memory; the 5 MB sample is streamed to a temporary file. |
| Vercel Functions | 4.5 MB request body | Accepted, including as base64 at about 2.8 MB. |
Use this file for
- Finding out whether a 1 MB default has been raised
- Checking encoding handling
- Testing line-ending normalisation
Testing notes for TXT
- Plain text compresses very well, so a 10 MB text file may travel as a fraction of that when gzip or Brotli is enabled. Use the BIN samples when you need incompressible bytes.
- Line endings change the byte count: converting LF to CRLF adds one byte per line, which breaks checksum comparisons.
Technical details
| File name | sample-txt-2mb.txt |
|---|---|
| Format | TXT (Plain text) |
| Extension | .txt |
| MIME type | text/plain |
| Size | 2,097,152 bytes (2 MB) |
| Kind | Text |
| SHA-256 | f86d06525c44a368cc8587b9bd1e6c654a0fb44710371b8091c6ea5d1524cf66 |
| Created | 2026-10-10 |
| Validation | Exact size, signature bytes and structure checked when the file was generated |
| Preview | Available on this page |
| Source | Generated for this site; not copied from elsewhere |
| Licence | Free to use, modify and redistribute (terms) |
| Category | Documents |
Validated for expected format and integrity. As with any download, scan the file with your own security tools before opening it. How files are made and checked
Download from the command line and verify
Fetch the file with curl, then compare its checksum with the SHA-256 value above.
curl -o sample-txt-2mb.txt 'https://sampletestfiles.com/downloads/txt/sample-txt-2mb.txt'
sha256sum sample-txt-2mb.txt # Linux
shasum -a 256 sample-txt-2mb.txt # macOSOn Windows, run Get-FileHash sample-txt-2mb.txt -Algorithm SHA256 in PowerShell. A matching value proves that the download is complete and unaltered.
Related files
Questions about this file
- Is this file exactly 2 MB?
- Yes. It is 2,097,152 bytes, which is 2 MB in the binary units that operating systems and server limits use (1 KB = 1,024 bytes).
- What is inside the 2 MB TXT file?
- 21,096 numbered lines of plain English text, each prefixed with its line number and starting byte offset so truncation is easy to spot. A closing rule of "=" characters brings the file to the exact size.
- Which encoding do the text samples use?
- The sized samples use only ASCII characters, which makes them valid UTF-8, ASCII and Latin-1 at once. A separate multilingual sample covers non-ASCII text.