Toolvist

Cryptographic Key Formatter

Normalize PEM keys, strip headers, or reflow certificate and key blocks into clean lines.

Accepts PEM blocks, raw base64, or a single escaped line.

Block type

—

Base64 chars

0

Decoded bytes

0

Status

—

Cryptographic Key & Certificate Formatter

Normalize PEM keys and certificates: reflow them to a clean width, strip or add headers, join a broken key back into one line, or inspect the block type and decoded size. Useful when a key copy-paste picks up stray whitespace or wrong line breaks.

Keys arrive in PEM, DER and raw forms — the RSA Key Generator produces the pairs this tool tidies, and AES uses the symmetric ones.

How to use the Key Formatter

  1. 1 Paste the PEM block, or the raw key body without its headers.
  2. 2 Choose what to do — strip the header and footer, add them back, or reflow the Base64 into fixed-width lines.
  3. 3 Check the preview for the type and length of the key it detected.
  4. 4 Copy the normalised output.

Cryptographic key format conversion and boundary normalization

The Key Formatter normalizes and converts cryptographic keys between common industry formats, including Privacy Enhanced Mail (PEM), raw Distinguished Encoding Rules (DER), PKCS#1, and PKCS#8. It cleans up missing newline headers, strips erroneous whitespace, and normalizes line wrapping to standard 64-character PEM boundaries.

Cryptographic libraries and web servers (such as Nginx, Apache, Node.js, and Java keytool) frequently reject keys that lack proper header delimiters (`BEGIN RSA PRIVATE KEY` vs `BEGIN PRIVATE KEY`) or possess Windows CRLF line-ending mismatches. The formatter ensures keys conform strictly to standard parser specifications.

  • Normalizes PEM key header and footer boundaries across PKCS#1 and PKCS#8 formats.
  • Cleans up corrupt whitespace, broken line wrapping, and improper line-ending delimiters.
  • Validates Base64 payload encoding within cryptographic certificate blocks.
  • Resolves key format parsing errors across Nginx, OpenSSL, and cloud identity services.

Frequently asked questions

Why are PEM keys wrapped at 64 characters?

A historical limit from early email systems, where long lines could be broken by a mail gateway and corrupt the data. The 64-character convention stuck and most parsers still expect it, so reflowing a mangled key back to that width often fixes it.

When would I want to strip the headers?

When the key goes into an environment variable, a JSON config value or a single-line secret store. Those formats cannot carry newlines cleanly, so the base64 body alone is used and the PEM header is re-added by whatever consumes it.

What is the difference between PKCS#1 and PKCS#8?

They are two ways of encoding the same key. PKCS#1 headers say BEGIN RSA PRIVATE KEY and carry only RSA; PKCS#8 says BEGIN PRIVATE KEY and can hold any algorithm. PKCS#8 is the modern, more portable choice, and many libraries accept both.

Related Security & Cryptography Tools

Browse all Security & Cryptography Tools →

You might also need

Tools from other categories that people pair with the Key Formatter:

Browse the full tool directory →