Upload, Compress & Split File

This tool compresses your file using LZString and splits the compressed output into manageable parts for download. Note: For very large files (multiple GBs), browser memory limitations might occur.

No file chosen
MB

For testing purposes, you might want to reduce the chunk size (e.g., 5-10MB) to see the splitting in action with smaller files.

Upload a file to begin.

How to Reassemble and Decompress:

  1. Download all parts in order.
  2. Concatenate them into a single file. For example, on Linux/macOS:
    cat original_file.part1.lz.txt original_file.part2.lz.txt > original_file.compressed.txt
    On Windows (CMD):
    copy /b original_file.part1.lz.txt + original_file.part2.lz.txt original_file.compressed.txt
  3. Use `LZString.decompressFromBase64()` on the concatenated string to get the original Base64 string.
  4. Convert the Base64 string back to the original file type (e.g., using a Base64 decoder tool or a simple script).

Example JavaScript for decompression:


// Assume 'compressedCombinedString' is the concatenated content of all .lz.txt parts
const originalBase64 = LZString.decompressFromBase64(compressedCombinedString);

// To download the original file:
const originalBlob = base64toBlob(originalBase64, 'application/octet-stream'); // Replace 'application/octet-stream' with original MIME type if known
const url = URL.createObjectURL(originalBlob);
const a = document.createElement('a');
a.href = url;
a.download = 'restored_file_name.ext'; // Use original file name
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);

// Helper function (e.g., from StackOverflow)
function base64toBlob(base64, mimeType) {
    const byteCharacters = atob(base64);
    const byteArrays = [];
    for (let offset = 0; offset < byteCharacters.length; offset += 512) {
        const slice = byteCharacters.slice(offset, offset + 512);
        const byteNumbers = new Array(slice.length);
        for (let i = 0; i < slice.length; i++) {
            byteNumbers[i] = slice.charCodeAt(i);
        }
        const byteArray = new Uint8Array(byteNumbers);
        byteArrays.push(byteArray);
    }
    return new Blob(byteArrays, { type: mimeType });
}