What is Data Chunking?

Data chunking divides a file, stream or other dataset into smaller units that software can handle separately. In a file-transfer or storage system, the software also needs enough information to put those chunks back into the intended order and reconstruct the original data.
Chunking can support independent retries, parallel transfers, deduplication and processing without loading an entire file at once. Those benefits depend on the surrounding application. Simply splitting a file does not compress it, make an interrupted upload resumable or guarantee that a restore will work.
For a UK home lab sending backups to remote storage, the useful questions are where the boundaries fall, what happens when a part fails and how the final result is verified. Our networking terminology guide connects chunking with the other storage and transfer concepts involved.
How are chunks kept in the right order?
The payload chunks contain pieces of the data. A separate description, often called a manifest or represented within other metadata, records how those pieces belong together. Its exact format depends on the application.
Useful information can include an object or file identity, the intended total length, each chunk's length, its position or sequence, and a value identifying or checking its contents. A variable-size layout needs a way to determine boundaries rather than assuming that every piece occupies the same number of bytes.
For example, dividing ten bytes into four-byte chunks produces lengths of four, four and two. The final short chunk is normal. Reconstructing the file means using the intended sequence, not sorting chunk names alphabetically or assuming that network arrival order is correct.
An ordered manifest can legitimately reference the same stored chunk more than once. A file containing two identical sections still needs both sections when restored, even if a deduplicating store keeps only one copy of their shared content.
Chunk identity is different from a boundary fingerprint
A content-defined chunker can use a rolling fingerprint to decide where to cut. That inexpensive boundary calculation is not necessarily suitable for identifying identical content or protecting against malicious modification.
A deduplication system normally needs a separate, suitably strong chunk identifier or comparison process. The Borg internals documentation, checked in its 1.4.5 documentation, explicitly separates its rolling buzhash boundary calculation from its cryptographically strong chunk hash or MAC.
Our checksum guide explains why the algorithm, the bytes covered and the trustworthiness of the expected value all matter. A matching chunk value does not by itself establish that the chunk belongs at a particular position in a particular file.
Fixed-size, content-defined and semantic chunking
The boundary rule determines what counts as a chunk. Different rules solve different problems.
Boundary approach | How the split is chosen | Main consequence |
|---|---|---|
Fixed-size byte chunks | Cut at regular offsets, with a possible shorter final piece | Simple offsets and predictable sizes; insertions can shift later content across boundaries |
Content-defined byte chunks | Choose boundaries from the local byte content, usually with size constraints | Can preserve matching regions after insertions or deletions; requires extra boundary analysis |
Record or structure boundaries | Split at suitable records, document sections or other defined units | Helps preserve units the application understands; sizes may vary |
Semantic text chunks | Group text according to meaning or related context | Useful for retrieval and language processing; not the same task as reconstructing a binary file |
Why fixed boundaries can lose matches
With fixed 64 KiB chunks, the first cut occurs after 65,536 bytes, the next after 131,072 bytes, and so on. An edit that replaces bytes without changing file length may affect only the chunks it overlaps.
An insertion behaves differently. Adding bytes near the beginning shifts subsequent content relative to the old cut points. Much of the file may contain the same underlying information while its newly cut chunks no longer match the old chunks exactly.
This does not mean fixed chunking is inherently wrong. It can suit aligned data, predictable access or a transfer protocol that primarily needs independently managed parts. It also does not mean a delta-transfer algorithm cannot recover matches across shifted data: chunk boundaries and the matching algorithm are separate design decisions.
How content-defined boundaries help
A rolling calculation examines a small moving window of data. When its fingerprint satisfies a boundary condition, the chunker can cut the stream. Minimum and maximum sizes limit very small or very large chunks, and the final remainder can still be shorter.
Because the decision depends on nearby content rather than only the absolute byte offset, the chunker can find corresponding boundaries again after an insertion. The disturbed region may need new chunks while later unchanged regions remain reusable. This is a useful property, not a promise that every edit changes exactly one chunk.
Implementations differ. Restic's documented design uses Rabin fingerprints, while Borg supports fixed and buzhash chunkers. The original FastCDC research describes another approach designed to reduce boundary-processing overhead. These names do not identify interchangeable algorithms or universal optimum settings.
Text and AI chunking use a different definition of usefulness
In search and retrieval-augmented generation, chunks can be passages, sections or token-limited pieces of a document. Preserving context may matter more than producing independently restorable byte ranges. Some systems deliberately overlap text between adjacent chunks.
That overlap duplicates content for a particular retrieval purpose. It should not be copied blindly into a binary file reconstruction process, where overlapping ranges need explicit handling. A chunk size measured in tokens also cannot be treated as the same quantity as a size measured in bytes.

Original test: what a small insertion does to chunk boundaries
We ran a local, in-memory experiment using Python 3.12.14 and a deterministic 4 MiB pseudorandom byte sequence generated with seed 20261024. The original contained 4,194,304 bytes. This was synthetic data, not a household backup corpus or encrypted traffic.
The fixed method used 64 KiB chunks. Our separate teaching chunker used a 64-byte rolling window, a 16 KiB minimum, a 256 KiB maximum and a cut condition based on the low 16 fingerprint bits being zero. It used polynomial arithmetic modulo 2 to the power of 64. It was not an implementation of Rabin fingerprints, Borg, restic or FastCDC.
We compared each updated chunk against all chunks from the original using SHA-256 and then verified the actual matching bytes. Every updated file was reassembled and checked byte for byte. The original produced 64 fixed chunks and 50 teaching content-defined chunks.
Controlled change at byte offset 12,345 | Method | Updated chunks | Payload bytes in chunks absent from the original |
|---|---|---|---|
Replace 4,096 bytes without changing length | Fixed 64 KiB | 64 | 65,536 |
Replace the same 4,096 bytes | Teaching content-defined | 50 | 34,981 |
Insert 37 bytes | Fixed 64 KiB | 65 | 4,194,341 |
Insert the same 37 bytes | Teaching content-defined | 50 | 35,018 |
After the insertion, none of the fixed chunks matched an original chunk. The teaching method retained 49 matching chunk occurrences, representing 4,159,323 reusable payload bytes. Together with 35,018 unmatched bytes, those reconstructed the 4,194,341-byte updated file exactly.
The unchanged control reused every original chunk under both methods. A same-length edit and an insertion therefore exposed different behaviour, even though both changed only a small region of the input.
What these results do, and do not, measure
These figures describe potentially reusable chunk payload against one existing version. They are not measured network traffic, storage bills or production deduplication ratios. Indexes, manifests, compression, encryption, framing and retries can add or change the bytes involved.
The two methods also used different chunk-size policies. This is a boundary demonstration, not a controlled equal-size performance ranking. We measured no CPU time, cloud service or broadband throughput, and a different file, edit position or algorithm can produce different results. The low-bit rule is not a guarantee that the observed average chunk size will be 64 KiB.
Why checking every chunk is not enough
A collection of valid chunks can still describe the wrong file. Order, completeness, file identity and total length are part of the reconstruction problem.
We tested a simple trusted local manifest containing sequence numbers, lengths, SHA-256 chunk values, total file size and a whole-file SHA-256 value. The reader checked each part, reconstructed the ordered bytes, then checked the whole result.
Local test | Observed result |
|---|---|
Valid manifest and chunks | Original file restored exactly |
Chunk store supplied in reverse arrival order | Original restored using manifest order |
One referenced chunk removed | Rejected as missing |
One byte altered inside a referenced chunk | Rejected by the chunk check |
Two manifest entries exchanged, retaining their old sequence numbers | Rejected by the sequence check |
Exchanged entries renumbered into a plausible new sequence | Rejected by the whole-file check |
A valid chunk substituted at the wrong position | Rejected by the whole-file check |
Two legitimate references to one identical stored chunk | Repeated content restored exactly |
The renumbered case is particularly useful. Every individual chunk hash still matched, and the total length was unchanged, but the assembled file differed from the original. A naive “all parts passed” check would have missed the wrong sequence.
Our manifest was a trusted local reference. An attacker able to replace both the manifest and the data could supply a different self-consistent result. Production systems need appropriate authentication and access controls as well as content checks. These tests were not a security audit or a crash-durability test.
How chunking supports retries and resumable uploads
Independent parts can make a failed transfer easier to recover, provided the receiver retains accepted work and the client knows what to continue. An application needs a session or object identity, accepted-part state or an authoritative byte offset, and rules for retrying and completing the operation.
Suppose a client loses a response after uploading a part. The receiver may already have accepted that part. Blindly appending it again can duplicate data; a suitable protocol lets the client reconcile receiver state or replace the identified part safely. Local splitting alone supplies none of that coordination.
The tus 1.0.0 resumable-upload specification illustrates an offset-based design: the client queries the receiver's current offset, then continues at that position. Its core protocol rejects an offset mismatch, while extensions cover features such as checksums, expiration and concatenating parallel partial uploads. Support must be checked rather than assumed.
Multipart upload is a concrete application
Amazon S3 multipart upload sends one object through separately identified parts, followed by an explicit completion request. Parts can arrive independently; completion uses part numbers to establish their order. Successful part uploads alone do not mean the final object has been completed.
The official S3 multipart overview explains the upload ID, part tracking, retries and completion process. This is one service's workflow, rather than a rule followed by every chunked transfer system.
S3's limits documentation, checked on 24 October 2026, specifies up to 10,000 parts and part sizes from 5 MiB to 5 GiB, with no minimum size for the final part. A service minimum and a sensible performance setting are different things. Check the current service and client limits when choosing settings.
For a NAS targeting object storage, the backup application's logical chunks and its object-upload parts may also be different units. Several stored chunks can be packed together, and a large pack can itself be uploaded in parts. Do not assume a one-to-one relationship.
Use the required checksum algorithm and checksum type. S3 distinguishes full-object and composite checksums; a multipart ETag should not be treated as an ordinary MD5 digest of the complete original file. Incomplete multipart work can also retain stored parts until completed or aborted, so abandoned-upload cleanup matters.
How large should chunks be?
There is no useful universal answer without the workload and protocol. Smaller chunks give finer retry or reuse granularity, but create more identifiers, requests and bookkeeping. Larger chunks reduce that count but can increase the work repeated after a failure or a local change.
For fixed chunks, the count is the file size divided by chunk size, rounded up. A final partial chunk still counts as one. State the units: 1 MiB is 1,048,576 bytes, while 1 MB in the following model is 1,000,000 bytes.
Original calculation: request overhead versus retry granularity
Consider a hypothetical 1 GB file at a constant 20 Mbit/s of file payload. Transferring its 1,000,000,000 bytes takes 400 seconds before additional delays. Now assume requests are strictly serial and each introduces 50 milliseconds of non-overlapping delay beyond payload transmission.
This is a generic teaching model, not an S3 configuration or a measured connection. In particular, its 1 MB row is smaller than S3's documented minimum for non-final multipart parts.
Decimal chunk size | Chunk count | Assumed total serial request delay | Payload plus assumed delays | Sending one whole chunk again |
|---|---|---|---|---|
1 MB | 1,000 | 50 seconds | 450 seconds | 0.4 seconds of payload |
10 MB | 100 | 5 seconds | 405 seconds | 4 seconds of payload |
100 MB | 10 | 0.5 seconds | 400.5 seconds | 40 seconds of payload |
The last column assumes the whole failed chunk must be retransmitted at the same payload rate. It is not an average failure cost or the expected amount of wasted work. Some protocols retain progress within a part, and several parts may be in flight when a connection fails.
The assumed 50-millisecond delay is not a rule that every chunk costs one extra round-trip time. Persistent connections, pipelining, parallel requests and server behaviour can change the timing substantially. The model exposes the trade-off; it does not predict a particular application's completion time.
Chunk size and concurrency must be considered together
More concurrent parts can help use capacity when one request leaves the path underused. They share the available path rather than creating extra broadband capacity. Beyond the useful level, additional workers can increase memory pressure, retries or competition with other traffic.
If an implementation holds one complete 64 MiB buffer for each of eight workers, those payload buffers alone occupy 512 MiB. That is conditional arithmetic, not a memory measurement or a requirement of every uploader. Streaming, additional copies, queues and libraries change the actual footprint.
For a UK household, measure the relevant upload speed, the application's complete elapsed time and the effect on other users. A high download headline does not tell you how quickly an off-site backup can leave the home. Chunk tuning cannot repair poor WiFi, a saturated upstream or a slow receiving service by itself.
Is chunking the same as packets or HTTP chunked encoding?
No. The word appears at several layers with different boundaries and purposes.
TCP provides applications with an ordered byte stream. RFC 9293 explicitly states that application read/write buffer boundaries need not align with TCP segment boundaries. An application chunk can span many network packets; one socket read is not reliable evidence that exactly one application chunk has arrived.
Packet loss on a working TCP connection can be repaired by transport retransmission without restarting an application part. A connection failure, expired session or rejected request can instead require application-level recovery. These are separate events and should be diagnosed separately.
HTTP/1.1 chunked transfer coding
In HTTP/1.1, Transfer-Encoding: chunked frames a message body using length-prefixed pieces. Each length is hexadecimal, and a zero-size chunk terminates the data, with the permitted final framing and any trailers. This allows a body to be sent without knowing its complete size in advance.
HTTP/1.1's RFC 9112, an Internet Standard published in June 2022, defines that coding. It is message framing, not automatic compression, persistent backup chunk storage or resumability after a failed connection. Intermediaries can also remove or recode that framing.
HTTP/2 uses DATA frames and does not use HTTP/1.1 chunked transfer coding. An application can still divide an upload into independently managed pieces over HTTP/2; that is a different layer from the message's transport framing.
How chunking relates to compression, deduplication and encryption
Chunking chooses units. Deduplication recognises repeated content and avoids keeping or sending unnecessary duplicate payload. Compression encodes suitable data in a smaller representation. Encryption protects confidentiality when correctly designed and used. None of those functions follows automatically from splitting bytes.
Our data compression article explains why data does not always shrink. Small independently compressed chunks can also have different overhead and redundancy opportunities from one larger compressed stream, so the arrangement needs testing.
The processing order matters. A system seeking plaintext duplicate matches needs access to comparable content or suitable identifiers before unrelated randomised encryption makes identical originals look different. Do not improvise encryption settings to recover deduplication: use the supported design of the backup or storage system.
Chunking is also not redundancy. If several files reference one shared stored chunk, losing that chunk can affect every file that needs it. Recovery points, retention, repository checks, independent copies and tested restores remain separate requirements. Referenced data must not be removed merely because one newer version no longer uses it.
A small chunking example you can verify
This Python example works entirely in memory. It divides ten bytes into chunks, records their hashes and reconstructs the original. It is a teaching example, not a resumable uploader or a secure manifest format.
import hashlib
original = b"ABCDEFGHIJ"chunk_size = 4chunks = [original[i:i + chunk_size] for i in range(0, len(original), chunk_size)]expected = [hashlib.sha256(part).digest() for part in chunks]assert [len(part) for part in chunks] == [4, 4, 2]assert all(hashlib.sha256(part).digest() == digest for part, digest in zip(chunks, expected))restored = b"".join(chunks)assert restored == originalprint([len(part) for part in chunks], restored.decode("ascii"))
The result is lengths of 4, 4 and 2, followed by ABCDEFGHIJ. The equality assertion checks the complete reconstruction; the separate chunk checks do not substitute for that. A real manifest reader also needs completeness, sequence, length and trusted-reference handling, as the earlier tests demonstrate.
How to test a real chunked workflow
Start with the outcome the application must deliver:
A large upload should recover from supported interruptions without silently duplicating or losing data.
A deduplicating backup should restore the intended version, including repeated content and its metadata.
A streaming processor should control its buffers and queues rather than merely splitting an already fully loaded file.
A search system should preserve useful context and be evaluated on retrieval results, rather than inherit binary-transfer settings.
For a NAS or file-upload workflow, use a disposable test dataset and proceed in order:
Check the client's supported chunk sizes, service limits, concurrency, checksum and resume features.
Record source size, content types, configuration and a trusted verification reference.
Measure a normal complete transfer and restore before changing settings.
Interrupt a test transfer, preserve its session state and check what the receiver has actually accepted before continuing.
Verify the final ordered bytes and required metadata, including a deliberate edit or insertion when evaluating reuse.
Compare elapsed time, retries, memory and network impact, then clean up abandoned test uploads using the application's supported controls.
Keep a consistent source version while testing. If the file changes between part reads, individually valid chunks can represent a mixture that was never the intended file. Snapshots, application quiescence or versioned input may be needed depending on the workload. Do not remove the original just because an uploader reports completion.
Troubleshooting chunked transfers and restores
Symptom | Relationship to investigate | Useful next check |
|---|---|---|
Upload starts again after interruption | Receiver state, client persistence or session expiry | Check documented resume support and reconcile the accepted offset or parts |
Many requests but poor throughput | Small parts, serial waits, service limits or processing overhead | Measure request behaviour and test a supported size/concurrency combination |
High memory use | Full-part buffers multiplied by worker count, plus queues and copies | Inspect actual process usage and buffering settings |
Small insertion causes a large update | Boundary shift, changed chunker policy or another transformation | Compare exact chunk matches and confirm which stage changed |
All part checks pass but restore is wrong | Order, file version, completeness or untrusted metadata | Verify the intended manifest and complete reconstructed content |
Missing shared chunk breaks several files | Deduplicated references without sufficient recovery protection | Run supported repository checks and recover from a known-good copy |
Storage remains after an abandoned upload | Unfinished upload state and cleanup policy | List and remove eligible abandoned work through supported controls |
Key takeaway
Data chunking makes data manageable in pieces. Its value comes from how those pieces are identified, transferred, reused and reconstructed. Choose boundaries and sizes for the actual job, then verify both the individual parts and the complete intended result.
Frequently asked questions
What is data chunking in simple terms?
Data chunking divides a file, stream or dataset into smaller units that software can handle separately. File storage and transfer systems also need enough information to reconstruct the intended data in the correct order.
Does chunking make a file smaller?
Splitting data alone does not reduce its payload size and can add metadata overhead. Deduplication and compression can reduce the stored or transferred representation when the data and application support them, but they are separate processes.
What is the difference between fixed-size and content-defined chunking?
Fixed-size chunking cuts at regular byte offsets. Content-defined chunking chooses boundaries from the data, usually with size limits, so it can recover corresponding boundaries after an insertion or deletion and preserve more reusable chunks in suitable workloads.
Does a chunked upload automatically resume after failure?
No. Resuming requires support in the client and receiver, retained session or object state, and a way to determine which bytes or parts were accepted. Splitting a local file is not sufficient.
Is HTTP chunked transfer encoding the same as a multipart upload?
No. HTTP/1.1 chunked transfer coding frames one message body using length-prefixed pieces. A multipart upload manages separately identified parts of an object and normally has its own completion and recovery rules.
What is the best chunk size?
There is no universal best size. Use the application's supported settings and service limits, then test representative data for elapsed time, retries, reuse, memory and correct reconstruction. Chunk size and concurrency should be assessed together.

