Java archive; compressed file package for classes and data (.jar)
.jar file signature | application/java-archive
Java Archive (JAR) is a ZIP-based file format defined as part of the Java platform, originally created by Sun Microsystems and maintained by Oracle. It is used to package compiled Java classes, metadata, resources, and libraries for application distribution, applets, and modular software deployment. Because JAR files can contain executable code and nested archives, they should be treated cautiously when obtained from untrusted sources and verified before use.
High Risk Format
This file type can contain executable code. Always validate the source and scan with antivirus before opening.
Magic Bytes
Offset 0
50 4B 03 04
Sources: Wikipedia, Gary Kessler
All Known Signatures
6 signature variants are documented for .jar files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 50 4B 03 04 | 0 | Wikipedia, Gary Kessler |
| 50 4B 05 06 | 0 | Wikipedia |
| 50 4B 07 08 | 0 | Wikipedia |
| 4A 41 52 43 53 00 | 0 | Gary Kessler |
| 50 4B 03 04 14 00 08 00 08 00 | 0 | Gary Kessler |
| 5F 27 A8 89 | 0 | Gary Kessler |
Extension
.jar
MIME Type
application/java-archive
Byte Offset
0
Risk Level
High
Validation Code
How to validate .jar files in Python
def is_jar(file_path: str) -> bool:
"""Check if file is a valid JAR by magic bytes."""
signature = bytes([0x50, 0x4B, 0x03, 0x04])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .jar files in Node.js
function isJAR(buffer: Buffer): boolean {
const signature = Buffer.from([0x50, 0x4B, 0x03, 0x04]);
return buffer.subarray(0, 4).equals(signature);
}
How to validate .jar files in Go
func IsJAR(data []byte) bool {
signature := []byte{0x50, 0x4B, 0x03, 0x04}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
/api/v1/jar
curl https://filesignature.org/api/v1/jar
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .jar file?
A .jar file is a Java archive; compressed file package for classes and data file. Java Archive (JAR) is a ZIP-based file format defined as part of the Java platform, originally created by Sun Microsystems and maintained by Oracle. It is used to package compiled Java classes, metadata, resources, and libraries for application distribution, applets, and modular software deployment. Because JAR files can contain executable code and nested archives, they should be treated cautiously when obtained from untrusted sources and verified before use.
What are the magic bytes for .jar files?
The magic bytes for Java archive; compressed file package for classes and data files are 50 4B 03 04 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .jar file?
To validate a .jar file, read the first bytes of the file and compare them against the known magic bytes (50 4B 03 04) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .jar files?
The primary MIME type for .jar files is application/java-archive.
Is it safe to open .jar files?
Java archive; compressed file package for classes and data (.jar) files are high risk because they can contain executable code. Never open .jar files from untrusted sources. Always scan with antivirus software, verify the source, and consider running in a sandboxed environment.