# .crt MIME Type: application/pkix-cert

> X.509 certificates in binary DER form. RFC 2585 registered application/pkix-cert for them.

- MIME type: `application/pkix-cert`
- Extensions: .crt, .cer, .der
- Also seen as: `application/x-x509-ca-cert`
- Content-Type header: `application/pkix-cert`
- Compress in transit: no (already compressed)
- File signature: `30 82` (an ASN.1 SEQUENCE, meaning DER encoding. A file that starts with -----BEGIN is PEM, whatever its extension)

## Good to know

- `.crt` and `.cer` files can be DER or PEM — the extension doesn't tell you. `openssl x509 -in cert.crt -noout -text` reads PEM; add `-inform der` for DER.
- Apache's stock config maps `.crt` and `.der` to `application/x-x509-ca-cert`, a type some clients, notably Android, treat as a CA certificate to install rather than a file to save.
- Certificate URLs inside certificates (the Authority Information Access extension) should serve DER as `application/pkix-cert`.

## Server configuration

### nginx (inside the types block in mime.types)

```
application/pkix-cert crt cer der;
```

### Apache (.htaccess or server config)

```
AddType application/pkix-cert .crt .cer .der
```

### Express

```
res.set("Content-Type", "application/pkix-cert");
```

### Python

```
import mimetypes

mimetypes.add_type("application/pkix-cert", ".crt")
mimetypes.add_type("application/pkix-cert", ".cer")
mimetypes.add_type("application/pkix-cert", ".der")
```

### HTML file input

```
<input type="file" accept=".crt,.cer,.der,application/pkix-cert">
```

## FAQ

### What is the MIME type for .crt files?

`application/pkix-cert`. You may also see `application/x-x509-ca-cert`, but `application/pkix-cert` is the one to send. The same type covers .cer, .der.

### What Content-Type header should a .crt file be served with?

`Content-Type: application/pkix-cert`. It's already compressed, so servers shouldn't gzip it.

### How can I tell if a file is really a .crt?

Check its bytes rather than the extension: CRT files start with `30 82` — an ASN.1 SEQUENCE, meaning DER encoding. A file that starts with -----BEGIN is PEM, whatever its extension. On the command line, `file --mime-type name.crt` does this for you.

## Related types

- [.pem — application/x-pem-file](https://www.devkult.com/mime/pem.md)
- [.bin — application/octet-stream](https://www.devkult.com/mime/bin.md)

Open the interactive page: https://www.devkult.com/mime/crt