Free JS sample, test and dummy files
JavaScript source code, as loaded by browsers and run by Node.js. Download valid JS test files in 19 exact sizes, from 1 KB to 100 MB, each with a checksum. Or create one of any size up to 1 GB.
- Extension
- .js
- MIME type
- text/javascript
- Kind
- Text
- Category
- Code
Create a JavaScript file of any size
Choose any size from 700 bytes to 1 GB. The file is made in your browser, so nothing is downloaded from our server. Smaller files usually finish quickly; generation time depends on your device and format. Larger ones are streamed straight into your downloads list in browsers that support it (current Chrome, Edge and Firefox on computers and Android); elsewhere, such as Safari and every browser on iPhone and iPad, the largest size is lower and is shown below.
JS files by size
Every file below is a valid JavaScript source file file of exactly the stated size. Open a file's page for its checksum and contents, and to preview it in your browser before downloading.
| File | Size | Contents | Download |
|---|---|---|---|
| 1 KB JS samplesample-js-1kb.js | 1 KB1,024 bytes | Records: 3 | Download JS |
| 5 KB JS samplesample-js-5kb.js | 5 KB5,120 bytes | Records: 37 | Download JS |
| 10 KB JS samplesample-js-10kb.js | 10 KB10,240 bytes | Records: 79 | Download JS |
| 25 KB JS samplesample-js-25kb.js | 25 KB25,600 bytes | Records: 206 | Download JS |
| 50 KB JS samplesample-js-50kb.js | 50 KB51,200 bytes | Records: 415 | Download JS |
| 100 KB JS samplesample-js-100kb.js | 100 KB102,400 bytes | Records: 834 | Download JS |
| 200 KB JS samplesample-js-200kb.js | 200 KB204,800 bytes | Records: 1,660 | Download JS |
| 500 KB JS samplesample-js-500kb.js | 500 KB512,000 bytes | Records: 4,133 | Download JS |
| 1 MB JS samplesample-js-1mb.js | 1 MB1,048,576 bytes | Records: 8,452 | Download JS |
| 2 MB JS samplesample-js-2mb.js | 2 MB2,097,152 bytes | Records: 16,785 | Download JS |
| 3 MB JS samplesample-js-3mb.js | 3 MB3,145,728 bytes | Records: 25,097 | Download JS |
| 5 MB JS samplesample-js-5mb.js | 5 MB5,242,880 bytes | Records: 41,709 | Download JS |
| 10 MB JS samplesample-js-10mb.js | 10 MB10,485,760 bytes | Records: 83,246 | Download JS |
| 15 MB JS samplesample-js-15mb.js | 15 MB15,728,640 bytes | Records: 124,402 | Download JS |
| 20 MB JS samplesample-js-20mb.js | 20 MB20,971,520 bytes | Records: 165,296 | Download JS |
| 25 MB JS samplesample-js-25mb.js | 25 MB26,214,400 bytes | Records: 206,189 | Download JS |
| 30 MB JS samplesample-js-30mb.js | 30 MB31,457,280 bytes | Records: 247,077 | Download JS |
| 50 MB JS samplesample-js-50mb.js | 50 MB52,428,800 bytes | Records: 410,663 | Download JS |
| 100 MB JS samplesample-js-100mb.js | 100 MB104,857,600 bytes | Records: 819,609 | Download JS |
What is a JS file?
A .js file contains JavaScript, the programming language of the web. Browsers download and execute it, and runtimes such as Node.js, Deno and Bun run it on servers.
The language is standardised as ECMAScript, with a new edition each year.
How to recognise a JS file
JS files have no file signature, the magic bytes that most binary formats begin with.
No signature bytes. JS files are identified by parsing their content.
| Extension | .js |
|---|---|
| MIME type | text/javascript |
| Standard | ECMA-262 (ECMAScript) |
| MIME type | text/javascript, per RFC 9239 |
| Encoding | UTF-8 |
| Module systems | ECMAScript modules and CommonJS |
What to test for
These are the behaviours that most often go wrong when software handles JS files.
- The old types application/javascript and application/x-javascript are obsolete; text/javascript is the registered type.
- Never execute an uploaded script. Treat .js uploads as text to be stored or analysed.
Strengths of JS
- Runs in every browser with no build step required.
- One language for browsers, servers and tooling.
Limitations of JS
- A single syntax error stops the whole file from running.
- Large scripts delay page interactivity while they parse and execute.
Typical uses of JS test files
- Testing bundlers and minifiers with large inputs
- Checking syntax highlighters and editors
- Testing static asset delivery and caching
Software that opens JS
- All web browsers
- Node.js, Deno and Bun
- esbuild, webpack, Rollup and Terser
Specifications
Related
JS sample files: questions
- Does the sample script do anything when loaded?
- No. It defines an array and two functions and has no side effects.
- What is the MIME type of a JS file?
- The MIME type is text/javascript. The file extension is .js.
- Is a sample JS file the same as a dummy or example JS file?
- Yes. Sample, test, dummy and example JS files are different names for the same thing: a JS file with known contents that stands in for a real one. Any file on this page will do wherever a tutorial or a test plan asks for a dummy JS file.