Encode or decode data using Base64.
low risk
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.
| Flag | Meaning |
|---|---|
-d --decode | Decode Base64 input |
-w --wrap | Wrap encoded lines at N characters (0 to disable) |
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 →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.
Reference text is hand-written and may be incomplete — check man base64 for your version. Test destructive commands on a non-production system first.