PEM, DER, CRT, CER, CSR — read the label, not the extension
The short answer
PEM is DER binary wrapped in base64 text. .crt, .cer and .pem often contain the same X.509 certificate and differ only in the extension someone chose. A .csr is not a certificate at all: it is a signed request asking a CA to issue one.
DER: tag, length, value
DER (Distinguished Encoding Rules) is the binary encoding of ASN.1 values. Every value is a tag, a length and content, one after another. A certificate parser only has to read those three fields repeatedly.
| Tag | Meaning | Where it appears |
|---|---|---|
| 0x30 SEQUENCE | ordered group | the certificate, tbsCertificate, names, extensions |
| 0x02 INTEGER | integer | version, serial number, RSA modulus |
| 0x06 OID | object identifier | algorithms, extension types, policies |
| 0x03 BIT STRING | bit string | public key, key usage flags, signature value |
| 0x04 OCTET STRING | byte string | DER inside an extension, key identifiers |
| 0x17 / 0x18 | time | UTCTime / GeneralizedTime validity |
When a length exceeds 128 bytes the length field grows to several bytes. DER forbids abbreviating lengths and forbids encoding the same value two ways, which is why two identical names can be compared byte for byte to decide whether they are the same issuer.
PEM: base64 folded at 64 columns
PEM places base64 between -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----, wrapped at 64 characters. The label in the header tells you what the block contains.
CERTIFICATE— one X.509 certificateTRUSTED CERTIFICATE— a certificate plus trust settings (mostly OpenSSL)CERTIFICATE REQUEST/NEW CERTIFICATE REQUEST— a CSRPRIVATE KEY,RSA PRIVATE KEY,EC PRIVATE KEY— private keys, which a checker never needs.
Trust the label over the extension
| Extension | Usually holds | Watch out |
|---|---|---|
| .pem | a certificate, key or chain | check the BEGIN label |
| .crt / .cer | one certificate | may be raw DER instead of PEM |
| .csr | a certificate signing request | no validity period or issuer |
| .key | a private key | never share it |
| .p12 / .pfx | certificate and key (PKCS#12) | needs a passphrase; this tool does not read it |
Extensions are names an operating system or tool attached. A .cer can be raw DER, and a .pem can contain three certificates. Opening the file and reading the BEGIN label is the only reliable test.
The shape of a certificate
An X.509 certificate has three parts. tbsCertificate holds the version, serial number, signature algorithm, issuer, validity, subject, public key and extensions. Then come the signature algorithm and the signature value. The signature is the issuer's private-key signature over the whole tbsCertificate.
That is why reading a certificate goes subject and issuer first, then validity and SAN, then signature algorithm and fingerprints. The workbench follows the same order.
A CSR is not a certificate
A CSR (Certificate Signing Request) carries a subject, a public key and requested extensions such as SAN, signed with the corresponding private key. It has no issuer, serial number or validity. Those appear only when a CA issues the certificate.
The CSR signature proves “I hold the private key for this public key”. The certificate signature proves “a CA checked this subject information”. They are not the same claim.
Common mistakes
- Pasting the explanatory sentence around the block from an email or document — the parser finds no header.
- Keeping a certificate and its private key in one file and sharing it — the private key leaks.
- Opening a DER file in a text editor — it is binary and unreadable.
- Mistaking an expired certificate for a new one — serial number and fingerprint differ.
This tool finds PEM blocks, decodes the base64 and reads the DER itself. Blocks it cannot read are listed with a reason, and any private-key header stops processing with a warning.
Questions
Should I send PEM or DER?
Follow what the recipient asks for. PEM is safer for pasting into text or email; DER is common for binary stores and some server configurations. This tool reads PEM.
Are .crt and .cer the same?
Often the content is identical, but not always. Windows tends to use .cer and Linux .crt; the real format is only known by opening the file and checking for a PEM label or binary DER.
What if a PEM file holds several certificates?
Usually the first block is the leaf, then intermediates, then the root. This tool reads each block and links issuers to subjects to judge the order.
Paste one certificate to see its format, block count and structure immediately.
Open the checkerThis article follows RFC 5280 and the CA/Browser Forum Baseline Requirements.