Skip to content

Java archive; compressed file package for classes and data (.jar)

.jar file signature | application/octet-stream

zip file formatand formats based on it, such asEPUB,JAR,ODF,OOXML

High

Magic Bytes

Offset 0
50 4B 03 04 50 4B 05 06 50 4B 07 08

Sources: Wikipedia

All Known Signatures

5 signature variants are documented for .jar files across multiple sources.

Hex Signature Offset Sources
50 4B 03 04 50 4B 05 06 50 4B 07 08 0 Wikipedia
4A 41 52 43 53 00 0 Gary Kessler
50 4B 03 04 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/octet-stream

Byte Offset

0

Risk Level

High

Validation Code

How to validate .jar files in Python

Python
def is_jar(file_path: str) -> bool:
    """Check if file is a valid JAR by magic bytes."""
    signature = bytes([0x50, 0x4B, 0x03, 0x04, 0x50, 0x4B, 0x05, 0x06, 0x50, 0x4B, 0x07, 0x08])
    with open(file_path, "rb") as f:
        return f.read(12) == signature

How to validate .jar files in Node.js

Node.js
function isJAR(buffer: Buffer): boolean {
  const signature = Buffer.from([0x50, 0x4B, 0x03, 0x04, 0x50, 0x4B, 0x05, 0x06, 0x50, 0x4B, 0x07, 0x08]);
  return buffer.subarray(0, 12).equals(signature);
}

How to validate .jar files in Go

Go
func IsJAR(data []byte) bool {
    signature := []byte{0x50, 0x4B, 0x03, 0x04, 0x50, 0x4B, 0x05, 0x06, 0x50, 0x4B, 0x07, 0x08}
    if len(data) < 12 {
        return false
    }
    return bytes.Equal(data[:12], signature)
}

API Endpoint

GET /api/v1/jar
curl https://filesignature.org/api/v1/jar

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .jar file?

A .jar file is a Java archive; compressed file package for classes and data file. zip file formatand formats based on it, such asEPUB,JAR,ODF,OOXML

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 50 4B 05 06 50 4B 07 08 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 50 4B 05 06 50 4B 07 08) 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?

There is no officially registered MIME type for .jar files. Systems typically use application/octet-stream as a generic fallback when handling this format.

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.