File size changer
Change a file to an exact size: when growing it reports the bytes to add and three fill strategies (zeros, deterministic bytes, repeating the original), when shrinking it gives the kept byte range from the head or tail, with no re-encoding.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Resize plan
Bytes to add or cut plus the kept range.
Enter the original and target sizes to calculate
Original bytes: 0 · Target bytes: 0 · Difference: 0 · Kept bytes: 0
What this tool does
- Find upload limits: truncate a file to a byte count and locate where a system starts rejecting it.
- Create fixed-size samples: pad a few hundred bytes up to 2 MB to test how a program handles large files.
- Strip trailing junk: keep the first N bytes and drop a log or checksum block appended at the end.
- Reason about integrity checks: knowing the target size and fill strategy lets you predict whether a stored hash will still match.
Example
Input
1024,2048
Output
Source file: 1024 B (1 KB / 0.001 MB) Target size: 2048 B (2 KB / 0.002 MB) Basis: 1 KB = 1024 B, 1 MB = 1,048,576 B, 1 GB = 1,073,741,824 B Bytes to add: 1024 B (1 KB / 0.001 MB) Fill method: all 0x00 bytes (smallest and most predictable; any program can read it). Order of operations: keep every source byte as is, then append the fill bytes described above. Expected output: 2048 B (2 KB / 0.002 MB) (+1024 bytes versus the source) Note: the content changes, so any checksum (MD5/SHA) of the original will no longer match.
Binary prefixes: 1 KB = 1024 B, 1 MB = 1,048,576 B; truncation does not re-encode, so the output is exactly the target size.
Frequently asked questions
What is added when growing the file?
One of three strategies: all 0x00 bytes (smallest and most predictable), a deterministic byte cycle from a seed (reproducible for hashing), or repeating the original content from the head so the file looks continuous. In every case the original bytes are kept untouched and the fill is appended.
Which part survives when shrinking?
By default the head is kept and the tail dropped, but you can keep the tail instead. The result prints the exact kept range — for example turning 2048 bytes into 1024 with tail-keeping keeps bytes 1024–2047.
Is anything re-encoded or compressed?
No. Truncation only drops bytes and padding only appends them, so the output is exactly the target size without line-ending conversions or other encoding surprises.
Why does it warn about hashes?
Any byte change invalidates MD5/SHA checksums. The warning is always printed so you do not assume that only the size changed.
What is the optional third input?
A unit override for the target size. By default both sizes share one unit; 1048576,2,MB means 'turn 1,048,576 bytes into 2 MB', which helps with cross-unit conversions.
What is the size limit?
2 GB. Browser handling of single files above that is unreliable, so use dd (Linux/macOS) or fsutil (Windows) on the command line instead.
Keywords:file resize