base64

Encode or decode data using Base64.

low risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

base64 encodes binary data as printable ASCII text, or decodes it back. Used in Kubernetes secrets, JWT tokens, basic auth headers, and embedding binary data in text formats. Note: base64 is encoding, not encryption — encoded data is trivially reversible.

Common flags
FlagMeaning
-d --decodeDecode Base64 input
-w --wrapWrap encoded lines at N characters (0 to disable)
Examples
echo -n 'admin:password' | base64Create Basic Auth header value · explain & risk-check →
echo 'YWRtaW46cGFzc3dvcmQ=' | base64 -dDecode Base64 string · explain & risk-check →
kubectl get secret mysecret -o jsonpath='{.data.password}' | base64 -dDecode a Kubernetes secret value · explain & risk-check →
cat cert.pem | base64 -w 0Base64 encode certificate without line wraps · explain & risk-check →
Pro tip

Use `echo -n` (no newline) before piping to base64 — without -n, the newline character is included in the encoding and your decoded value will have a trailing newline.

Related
openssl kubectl jq
Open the full explainer →More in Text Processing

Reference text is hand-written and may be incomplete — check man base64 for your version. Test destructive commands on a non-production system first.