flashman
← All tools

Pem Key Newline

pem • key • newline • env

PEM key newline converter

Convert public and private key blocks to one-line values with literal \n escapes, or restore escaped keys back to PEM format.

-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwFlashmanDemo\n-----END PUBLIC KEY-----
-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAFlashmanDemo\n-----END PRIVATE KEY-----
PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwFlashmanDemo\n-----END PUBLIC KEY-----"
PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAFlashmanDemo\n-----END PRIVATE KEY-----"

About this tool

Convert PEM public and private key blocks into single-line strings with literal \n escapes for .env files, JSON config, CI secrets, and serverless settings.

Your input is processed in the browser. We do not upload tool payloads to our servers.

Common use cases

  • Store RSA or EC private keys in environment variables that cannot contain multiline values.
  • Prepare public keys for JSON configuration without manually replacing line breaks.
  • Restore escaped key strings from logs or config back to readable PEM blocks.

Examples

PEM to escaped .env value

Paste a key block and the output keeps the BEGIN/END markers while replacing real line breaks with literal \n sequences.

PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nMIIEv...\n-----END PRIVATE KEY-----"

FAQ

Are private keys uploaded?
No. Conversion happens in your browser. Still prefer test keys unless you are comfortable handling the secret on this device.
Does this validate the key cryptographically?
No. It only transforms newline formatting so keys fit into single-line config values.

Related tools