PEM to Base64

Remove PEM armor and whitespace to extract its Base64-encoded DER bytes.

Your workspace

Processed in your browser

Enter your values or try the example.

This utility extracts the raw Base64-encoded content from a PEM (Privacy-Enhanced Mail) formatted block. PEM files are essentially Base64-encoded DER data wrapped in headers and footers like '-----BEGIN PUBLIC KEY-----'. This tool strips away that armor, leaving you with the clean Base64 string required for many programmatic APIs and cryptographic libraries.

Extracting Base64 data

  1. Paste your complete PEM block, including the 'BEGIN' and 'END' lines, into the input area.
  2. The tool automatically identifies the PEM structure, removes the framing, and outputs the raw Base64-encoded string.
  3. Copy the resulting Base64 string for use in your application or further cryptographic operations.

Understanding PEM and DER

PEM is a text-based format that makes binary data (DER) easier to handle and transport. By converting PEM to Base64, you are essentially exposing the raw encoded data that sits inside the file. This tool does not validate the internal structure of the key, such as its ASN.1 format; it only handles the removal of the text-based framing.

Conversion example

-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE...\n-----END PUBLIC KEY-----

MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE...

Questions about PEM processing

Does this tool validate the key structure?

No, it only validates that the input is a correctly formatted PEM block and extracts the Base64 content. It does not check if the underlying key is valid.

Can I convert back from Base64 to PEM?

Yes, you can use a separate PEM-encoding tool to re-wrap the Base64 string with the appropriate headers and footers.

Continue your workflow

Explore more tools in this category for your next step.