CPIO (.cpio)
.cpio file signature | application/x-cpio
CPIO is a Unix archive file format originally created for early System V and now maintained as part of POSIX and related Unix toolchains. It is used to package files for backups, software distribution, initramfs images, and other archival or transfer tasks. The format is a legacy standard with simple structure; archives from untrusted sources should still be handled carefully because they may contain unexpected paths or overwrite files during extraction.
Magic Bytes
Offset 0
30 37 30 37 30 37
Sources: Apache Tika, Wikipedia
All Known Signatures
3 signature variants are documented for .cpio files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 30 37 30 37 30 37 | 0 | Apache Tika, Wikipedia |
| 30 37 30 37 30 31 | 0 | Apache Tika, Wikipedia |
| 30 37 30 37 30 32 | 0 | Apache Tika, Wikipedia |
Extension
.cpio
MIME Type
application/x-cpio
Byte Offset
0
Risk Level
Safe
Validation Code
How to validate .cpio files in Python
def is_cpio(file_path: str) -> bool:
"""Check if file is a valid CPIO by magic bytes."""
signature = bytes([0x30, 0x37, 0x30, 0x37, 0x30, 0x37])
with open(file_path, "rb") as f:
return f.read(6) == signature
How to validate .cpio files in Node.js
function isCPIO(buffer: Buffer): boolean {
const signature = Buffer.from([0x30, 0x37, 0x30, 0x37, 0x30, 0x37]);
return buffer.subarray(0, 6).equals(signature);
}
How to validate .cpio files in Go
func IsCPIO(data []byte) bool {
signature := []byte{0x30, 0x37, 0x30, 0x37, 0x30, 0x37}
if len(data) < 6 {
return false
}
return bytes.Equal(data[:6], signature)
}
API Endpoint
/api/v1/cpio
curl https://filesignature.org/api/v1/cpio
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .cpio file?
A .cpio file is identified by the magic bytes 30 37 30 37 30 37 at byte offset 0. CPIO is a Unix archive file format originally created for early System V and now maintained as part of POSIX and related Unix toolchains. It is used to package files for backups, software distribution, initramfs images, and other archival or transfer tasks. The format is a legacy standard with simple structure; archives from untrusted sources should still be handled carefully because they may contain unexpected paths or overwrite files during extraction.
What are the magic bytes for .cpio files?
The magic bytes for CPIO files are 30 37 30 37 30 37 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .cpio file?
To validate a .cpio file, read the first bytes of the file and compare them against the known magic bytes (30 37 30 37 30 37) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .cpio files?
The primary MIME type for .cpio files is application/x-cpio.
Is it safe to open .cpio files?
CPIO (.cpio) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.