Base64 Encoder/Decoder

Encode and decode Base64 strings with full UTF-8 support — handles secrets, JSON, and any Unicode text.

Plain Text
Enter text to encode (UTF-8 supported)
Base64 Output
Encoded result
Using Base64 in Kubernetes, Docker & Cloud Infrastructure

Base64 translates arbitrary binary data or multi-line configuration files into a safe 64-character ASCII alphabet (A–Z, a–z, 0–9, +, /, with = padding). In DevOps and platform engineering, Base64 shows up everywhere text-only protocols or YAML/JSON configuration files need to carry raw bytes, TLS certificates, or credentials without escaping issues.

Common DevOps Use Cases

  • Kubernetes Secrets (data: vs stringData:): Values under data: in a Kubernetes Secret manifest must be Base64-encoded.
  • Docker Registry Pull Secrets (.dockerconfigjson): Private registry credentials combine username:password in Base64 inside a JSON structure that is itself Base64-encoded for Kubernetes imagePullSecrets.
  • Cloud-Init & EC2/Azure VM User Data: Terraform and cloud APIs pass bootstrap scripts (user_data_base64 / custom_data) as Base64 strings.
  • CI/CD Multiline Secrets: Encoding PEM private keys or kubeconfig files into single-line Base64 strings makes them safe to pass through CI environment variables.

Terminal CLI Equivalents

Watch out for trailing newlines (-n) and line wrapping (-w 0 on GNU coreutils) when encoding from a shell:

# Encode without a trailing newline
printf '%s' 'my-db-password' | base64

# Encode on Linux without 76-char line wrapping
printf '%s' 'my-db-password' | base64 -w 0

# Decode a Kubernetes Secret key directly
kubectl get secret app-secret -o jsonpath='{.data.API_KEY}' | base64 -d
Frequently Asked Questions

Is Base64 encoding a form of encryption?

No. Base64 is a binary-to-text encoding scheme (RFC 4648), not encryption. Anyone can decode a Base64 string without a key. In Kubernetes, Secret data fields are Base64-encoded only so binary data can be represented safely inside YAML manifests—always enable etcd encryption at rest and strict RBAC.

Why did my Kubernetes Secret fail with a trailing newline bug?

Running echo 'my-secret' | base64 in a terminal encodes the trailing newline character (\n) that echo appends by default, causing authentication failures when the application reads the secret. Always use echo -n 'my-secret' | base64 or printf '%s' 'my-secret' | base64—or use this browser tool, which encodes the exact string you paste.

How does this tool handle Unicode and UTF-8 characters?

Standard browser btoa() and atob() functions only support Latin-1 characters and throw errors or corrupt multi-byte UTF-8 text. This tool uses TextEncoder and TextDecoder to convert strings to and from raw UTF-8 byte arrays before Base64 conversion.

Are secrets pasted here transmitted over the network?

Never. All Base64 encoding and decoding runs entirely inside your browser tab using client-side JavaScript. Nothing is logged or sent to any server.

Related Engineering Guides

Learn how to manage credentials and secrets properly in production: