Binary File Generator

Fills a byte array with cryptographically random data using the browser's crypto API and lets you download it as a .bin file, with a spaced hex dump shown alongside for a quick look at the raw bytes. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-22

Overview

Introduction

Some tests specifically need binary data, not text, to confirm that an upload form, transfer script, or compression tool behaves correctly on non-textual content.

This tool generates that data instantly and lets you download it as a .bin file.

What Is Binary File Generator?

A random binary file generator that fills a byte array with cryptographically random values and offers it for download, alongside a hex dump so you can see the actual bytes without opening the file elsewhere.

Everything happens locally in your browser; no data is generated on or sent to a server.

How Binary File Generator Works

A Uint8Array of the requested size is filled using crypto.getRandomValues(), the same secure randomness source browsers use for generating cryptographic keys and tokens.

The raw bytes are offered for download as a Blob with an application/octet-stream MIME type, while a separate hex-encoded string (two hex digits per byte, space-separated) is rendered for a quick visual preview.

When To Use Binary File Generator

Use it when you need incompressible, non-textual test data: confirming an upload accepts arbitrary binary content, benchmarking a compression tool against data that shouldn't compress well, or generating a throwaway file to test transfer speed.

It's also useful for filling a file with unpredictable content when you specifically don't want structured or guessable bytes.

Features

Advantages

  • Uses a cryptographically secure random source rather than a predictable pseudo-random generator.
  • Instant, local generation with a live hex preview.
  • Simple, adjustable size control.

Limitations

  • Capped at 65,536 bytes per generation due to the browser's crypto.getRandomValues() limit.
  • The hex preview becomes unwieldy to read at larger sizes; it's meant as a spot-check, not a full hex editor.

Examples

Generating 8 random bytes

Input

sizeBytes: 8

Output

3f a2 09 c4 7e 01 bb 5d

Each byte is rendered as two lowercase hex digits, separated by a space, in the order the random bytes were generated.

Best Practices & Notes

Best Practices

  • Keep the size close to what you actually need to test, since larger files take longer to render as a hex preview.
  • Use Convert Hex to a String if you need to inspect a specific byte range as text.
  • Combine with Generate an Empty File when you need both a zero-byte and a random-content test case.

Developer Notes

Downloading passes the Uint8Array directly to the Blob constructor rather than converting it to a JavaScript string first, since round-tripping arbitrary byte values through a UTF-16 string and back would corrupt any byte above 0x7F.

Binary File Generator Use Cases

  • Testing that an upload form accepts arbitrary binary files
  • Benchmarking compression or transfer tools against incompressible data
  • Generating a throwaway file with unpredictable content

Common Mistakes

  • Assuming the hex preview is an efficient way to inspect large files; it's meant for a quick spot-check, not full analysis.
  • Requesting more than 65,536 bytes in one generation; the browser's random source can't fill that in a single call.

Tips

  • If you need a much larger binary file, generate this one repeatedly and concatenate the downloads with a local tool.
  • The hex preview format matches what Convert Hex to a String and Convert a String to Hex expect, so you can copy a slice directly between them.

References

Frequently Asked Questions