Base64 Chunk Splitter – Free

This Base64 chunk splitter validates a Base64 string or data URL, normalizes it and cuts it into lines of a fixed length. Each line is a byte-aligned chunk that a receiver can decode or reassemble.

How to use the Base64 Chunk Splitter tool

  1. Paste the value into Base64 or data URL, or select Example for a short sample.
  2. Enter the line length in Characters per chunk (multiple of 4), for example 64 or 76.
  3. Select Split to cut the string.
  4. Copy the chunks from the Result box, one per line, or use the Download link to save them as chunks.base64.

How the Base64 chunk splitter works

Splitting happens in two passes. First the input is decoded and encoded again. This proves the value is valid and gives a canonical form: a data URL header is dropped, whitespace and old line breaks vanish, the URL-safe characters - and _ become + and /, and padding is added if it was missing. Second, the clean string is sliced every N characters and the slices are joined with line feeds.

Every line has exactly N characters apart from the last, which holds the remainder and any = padding. If the string is no longer than N, the output is a single line.

Why the chunk size must be a multiple of 4

Base64 maps 3 bytes to 4 characters, so a cut is only clean on a 4-character boundary. With a size such as 16, each full line stands for exactly 12 bytes and can be decoded without its neighbors. That lets a receiver process chunks as they arrive, write them to disk one by one, or retry a single failed piece.

A size like 10 would leave lines that begin or end in the middle of a byte group, so the tool rejects it with Choose a chunk size that is a multiple of four. The allowed range is 4 to 1,048,576 characters.

Worked example with 16-character chunks

The sentence The quick brown fox jumps over the lazy dog. is 44 bytes, which encodes to 60 Base64 characters. Splitting at 16 yields three full lines and a final line of 12 characters that carries the single padding character.

Each full line decodes to 12 bytes of the sentence: The quick br, then own fox jump, then s over the l. The last line decodes to the remaining 8 bytes.

Input:  VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4=
Size:   16

VGhlIHF1aWNrIGJy
b3duIGZveCBqdW1w
cyBvdmVyIHRoZSBs
YXp5IGRvZy4=

Picking a chunk size for your transport

The right size depends on the channel that carries the text, and a few values are conventional.

The output uses a single line feed between chunks. Protocols that require CRLF line endings, as MIME does, need that conversion on your side.

  • 76 characters is the line limit for Base64 bodies in MIME email (RFC 2045).
  • 64 characters is the line length of PEM files such as certificates and keys (RFC 7468).
  • Message queues, WebSocket frames and SMS or chat gateways each have their own cap per message. Choose the largest multiple of 4 that fits beside your envelope.
  • For chunked uploads, sizes such as 65,536 or 1,048,576 characters keep the number of requests low.

Frequently asked questions

Can I split Base64 at any character count?

Not in this tool. The size must be a multiple of 4 between 4 and 1,048,576. That rule keeps every chunk aligned to whole bytes, so pieces can be decoded independently and rejoined with either option of the Base64 Chunk Joiner.

Does splitting change the encoded data?

The bytes stay identical. The text may change form, because the tool normalizes before cutting: URL-safe input becomes standard Base64, a data URL header is removed and padding is restored. Joining the lines gives the normalized string.

How do I put the chunks back together?

Remove the line breaks, or paste the lines into the Base64 Chunk Joiner and choose Slices of one Base64 sequence. Because each chunk is byte-aligned, the Independently encoded blocks option produces the same result.

Does it add CRLF line endings or PEM headers?

No. Lines are separated by a single line feed and nothing is added before or after. Wrap the output in BEGIN and END lines yourself for PEM, and convert the line endings if your protocol demands CRLF.

Is my Base64 sent to a server for splitting?

No. Validation and splitting run in your browser, and the downloadable chunks.base64 file is generated on your device.

Related tools