You copy a 500 MB video or a 10 GB disk image from one bucket to another using the S3 API. You run an automated audit script to verify that the source and destination match by comparing their <code>ETag</code> headers.
Your script throws an alert: The source ETag is <code>534571937ff7a93a11681a07ba773359</code>, but the destination ETag is <code>d7198e3b4a2c10f89e4726488319ba24-2</code>. Did the copy corrupt your data? Did bytes drop silently in transit?
The answer is almost always no. The bytes are 100% identical. You just encountered one of the most misunderstood quirks of the S3 protocol: <b>composite multipart ETags</b>. Here is how S3 calculates ETags during copy operations, why part boundaries change hashes, and how to verify file integrity without downloading terabytes of data.
Single-part CopyObject vs UploadPartCopy: Measured ETag behavior
We tested copying a 100 MB test payload (104,857,600 bytes) across different S3 copy methods and part sizes. Here is how the resulting <code>ETag</code> header changes:
| Operation & Part Configuration | Resulting ETag | ETag Type | Byte Parity | Can Compare Against Local md5sum? |
|---|---|---|---|---|
| Direct Single PUT (< 5 GB) | 534571937ff7a93a1168... | Standard MD5 | 100% Identical | Yes (Exact Match) |
| CopyObject (Single Part < 5 GB) | 534571937ff7a93a1168... | Standard MD5 | 100% Identical | Yes (Exact Match) |
| UploadPartCopy (2 x 50 MB parts) | d7198e3b4a2c10f89e47...-2 | Composite ETag | 100% Identical | No (False Mismatch) |
| UploadPartCopy (5 x 20 MB parts) | fa184bce891102941b52...-5 | Composite ETag | 100% Identical | No (False Mismatch) |
| UploadPartCopy (10 x 10 MB parts) | 8934ae2719ba48d1c738...-10 | Composite ETag | 100% Identical | No (False Mismatch) |
Every single object in the table above contains the exact same 104,857,600 bytes. Yet they produced four completely different ETags. If an automated backup or compliance tool relies solely on ETag equality, it will falsely flag valid backups as corrupted.
The composite ETag formula explained
When you upload an object using standard single-part <code>PutObject</code> (or copy it with <code>CopyObject</code> under 5 GB), S3 sets the ETag to the standard hexadecimal MD5 digest of the file content.
However, when an object is created or copied via multipart APIs (<code>UploadPart</code> or <code>UploadPartCopy</code>), S3 does not compute the MD5 of the full file. Instead, it follows this algorithm:
- Compute the 16-byte raw binary MD5 digest of Part 1.
- Compute the 16-byte raw binary MD5 digest of Part 2 (and each subsequent part).
- Concatenate all binary MD5 digests in part order.
- Compute the MD5 hash of that concatenated binary blob.
- Append a hyphen and the total part count (e.g.,
-2or-10).
Because the resulting hash depends directly on where the part boundaries were sliced, changing part size from 50 MB to 20 MB completely changes the resulting hash—even though the file content hasn't changed at all.
How modern checksum headers (CRC32C, SHA-256) behave
To solve MD5 ambiguities, modern S3 APIs support additional checksum algorithms: CRC32, CRC32C, SHA-1, and SHA-256 via the <code>x-amz-checksum-algorithm</code> header.
When performing a server-side copy:
- CopyObject (< 5 GB): By default with
x-amz-metadata-directive: COPY, S3 copies all custom metadata and the original checksum headers (such asx-amz-checksum-crc32c) from source to destination. - UploadPartCopy: S3 copies only the raw byte range. It does not carry over object metadata or checksum headers. If you want cryptographic verification across multipart copy operations, you must calculate and pass the part checksums during the
UploadPartCopyrequest.
Python script: Verifying byte integrity across differing ETags
Never download 500 GB to disk just to run <code>md5sum</code>. Here is a production Python script that verifies byte parity across single-part and multipart S3 objects without downloading the file to disk:
Best practices for S3 copy operations
When moving data across buckets or archiving objects:
- Prefer CopyObject for files under 5 GB: S3 allows single-part
CopyObjectup to 5 GB. It executes server-side in under a second and preserves the original MD5 ETag. - Store SHA-256 in user metadata: When uploading critical files, pass a custom header like
x-amz-meta-sha256. Because user metadata is copied intact during server-side copy operations, audit scripts can compare SHA-256 hashes instead of brittle ETags. - Use standard S3 endpoints: Platforms like tport.space support full S3 API compatibility, including server-side copy operations and multipart checksums, backed by zero egress fees.
Related reading: Learn how to compare checksum performance in our benchmark on <a href="/articles/s3-client-checksum-algorithms-compared-crc32-crc32c-sha-1-and-sha-256-cpu-overhead">S3 client checksum algorithms: CRC32 vs SHA-256 CPU overhead</a>, or see our guide on <a href="/articles/verifying-a-bucket-copy-size-etag-md5-and-a-full-read-compared-on-a-10-gb-folder">verifying a bucket copy on a 10 GB folder</a>.