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 Paste the PEM block, or the raw key body without its headers.
- 2 Choose what to do — strip the header and footer, add them back, or reflow the Base64 into fixed-width lines.
- 3 Check the preview for the type and length of the key it detected.
- 4 Copy the normalised output.
How to Use
Paste a PEM block, a raw base64 blob, or an escaped one-line key. Choose an output format and the tool reflows it correctly.
- Detects the PEM block type automatically
- Reflow to 64 characters (the PEM standard) or one line
- Strip headers to get the raw base64
- Add or repair headers for a raw base64 blob
- Reports decoded byte length and fingerprint
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
You might also need
Tools from other categories that people pair with the Key Formatter: