DER to PEM Converter

Choose a binary DER file and get it back as PEM text, with the right BEGIN line written for you.

FluffyShield Protected workspace
FluffyShield

Isolated workspace: other page scripts can't read your files. How FluffyShield works

Free · No upload · No sign-up · No usage quotas

What's in a .der file you can't open?

You don't need to know before you start. The converter works it out from the bytes and labels the PEM for you.

What the converter does
  1. Read how the bytes are laid out
  2. Pick the BEGIN line that fits
  3. Spell the bytes out in letters

What it does

Five file endings

Files ending .der, .cer, .crt, .csr or .pub can all be chosen.

Old RSA keys

An RSA key stored as its two bare numbers gets RSA PUBLIC KEY.

Lines of 64

The letters are cut into lines that long, and the block ends with a line break.

Limits One file at a time, up to 16 MiB.

A file that won't open as text

Someone has sent you a file ending in .der and a set of instructions that wants PEM, the kind of key or certificate that starts with a BEGIN line. Open the .der in a text editor and you get a short burst of odd symbols. Nothing is broken: the file isn't text. It's bytes, and most bytes aren't letters.

PEM is those same bytes spelled out in plain letters, with a line above saying what they are and a line below closing them off. That's what lets a PEM block be pasted into an email or a settings box. Converting adds the spelling and the two lines, and changes nothing else.

How the converter knows what to call it

A DER file has no label of its own. The file name doesn't count, because it's only what somebody typed. So the converter looks at how the bytes are put together.

Every one of these files is a list of parts, some of them lists themselves. A bare public key is two parts: what kind of key it is, and the key. A certificate is three: the details, the signing method, and the signature of whoever issued it. A signing request is three parts as well, with different details inside. Each shape gets its own BEGIN line.

We gave it two files that open with the same byte, 30, which says only that a list follows. The sample key, 91 bytes, came back as BEGIN PUBLIC KEY. The sample signing request, 327 bytes, came back as BEGIN CERTIFICATE REQUEST. Nobody had to say which was which.

Opening your .der file as text

The box at the top of this page, FluffyBench's Certificate and public key inspector set to DER to PEM, works from the file itself. There's nothing to paste, since a DER file isn't text.

  1. Press Choose file and pick your .der file.

  2. The PEM text shows under Result straight away, its BEGIN line already chosen to match the file. The file's name and size sit just above it, so you can see it's the right one.

    The file sample-p256.pub.der, 91 bytes, in the list, and below it the Result box holding a PUBLIC KEY block, with Copy and Download.
    The file sample-p256.pub.der, 91 bytes, in the list, and below it the Result box holding a PUBLIC KEY block, with Copy and Download.
  3. Press Download to save it as public-object.pem.

Files it won't convert

A file that is already PEM gets "DER-to-PEM needs a binary DER file." It's text already, so there's nothing to do.

A download that stopped early, or a file with something stuck on the end, fails the layout check: "The ASN.1 data is malformed, incomplete, or has bytes after the public object." We cut the last 10 bytes off the sample key to see it happen.

Anything that isn't a certificate, a request or a public key gets a message that ends "Private keys and key containers are not accepted." That covers a private key saved as DER, and key containers such as .p12 files, which keep a private key beside a certificate. Neither belongs in a web page.

You'll need DER again after editing the text

PEM to DER Converter

It gives back the same bytes, and checks the label still matches them first.

The PEM turned out to be a certificate, and you want to read it

Certificate and public key inspector

Its Certificate tab opens DER files directly and shows the names and dates inside.

Search FluffyBench