1 MB JS sample file

A JS file of exactly 1,048,576 bytes. It is a valid JavaScript source file file, generated for this site and checked with an independent parser.

Download

sample-js-1mb.js

1 MB1,048,576 bytes

Download 1 MB JS

Direct download. No sign-up and no waiting.

Type
text/javascript
SHA-256
67e0db87a116643a56f2dd7c8a60e173901f0f1465651c92f2453760abf52411
Direct URL
https://sampletestfiles.com/downloads/js/sample-js-1mb.js

What is in this file

A "records" array of 8,427 object literals and two small helper functions. Line comments at the end bring the script to the exact size.

Array entries8,427
SyntaxECMAScript 2015+, strict mode
Side effects on loadNone
EncodingUTF-8 (ASCII characters only)

How the file begins

The opening lines of sample-js-1mb.js, exactly as they appear in the file.

// SampleTestFiles sample JavaScript file (1 MB)
// Plain ECMAScript with no dependencies. It defines data and two helper functions and runs nothing on load.
'use strict';

const records = [
  { id: 1, name: 'Ethan Zeller', email: 'ethan.zeller1@example.com', plan: 'team', balance: 2769.84, active: true },
  { id: 2, name: 'Elena Underhill', email: 'elena.underhill2@example.net', plan: 'free', balance: 4647.61, active: true },
  { id: 3, name: 'Ethan Farrow', email: 'ethan.farrow3@example.org', plan: 'business', balance: 536.73, active: false },
  { id: 4, name: 'Victor Brennan', email: 'victor.brennan4@example.com', plan: 'business', balance: 2410.43, active: true },
  { id: 5, name: 'Felix Ibarra', email: 'felix.ibarra5@example.net', plan: 'starter', balance: 2832.21, active: false },

Preview

Shows the first 64 KB of the file.

Where 1 MB matters

A 1,048,576-byte file: exactly the default upload limit of nginx, Spring Boot and Next.js. These are the default limits a file of this size is useful for testing:

SystemLimitNote
nginx1 MB by default (client_max_body_size)A multipart upload of this file exceeds the limit by the size of the form boundaries.
Spring Boot multipart1 MB per file by default (max-file-size)A file of exactly 1 MB is at the limit.
Next.js API routes and Server Actions1 MB by defaultLarger bodies need the size limit raised in configuration.
Cloud Firestore documents1 MiB (1,048,576 bytes)The same number of bytes as this file.
Apache Kafka messagesAbout 1 MB by defaultBrokers reject larger records unless message.max.bytes is raised.

All 1 MB sample files

Use this file for

  • Download tests on mobile connections
  • Checking syntax highlighters and editors
  • Testing static asset delivery and caching

Testing notes for JS

  • Never execute an uploaded script. Treat .js uploads as text to be stored or analysed.
  • The old types application/javascript and application/x-javascript are obsolete; text/javascript is the registered type.

JS format reference

Technical details

File namesample-js-1mb.js
FormatJS (JavaScript source file)
Extension.js
MIME typetext/javascript
Size1,048,576 bytes (1 MB)
KindText
SHA-25667e0db87a116643a56f2dd7c8a60e173901f0f1465651c92f2453760abf52411
Created2026-10-10
ValidationExact size, signature bytes and structure checked when the file was generated
PreviewAvailable on this page
SourceGenerated for this site; not copied from elsewhere
LicenceFree to use, modify and redistribute (terms)
CategoryCode

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-js-1mb.js 'https://sampletestfiles.com/downloads/js/sample-js-1mb.js'
sha256sum sample-js-1mb.js     # Linux
shasum -a 256 sample-js-1mb.js # macOS

On Windows, run Get-FileHash sample-js-1mb.js -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 1 MB?
Yes. It is 1,048,576 bytes, which is 1 MB in the binary units that operating systems and server limits use (1 KB = 1,024 bytes).
What is inside the 1 MB JS file?
A "records" array of 8,427 object literals and two small helper functions. Line comments at the end bring the script to the exact size.
Does the sample script do anything when loaded?
No. It defines an array and two functions and has no side effects.