JSON to Base64
Encodes any valid JSON string into a Base64 representation ready for embedding in HTTP headers, data URIs, or JWT payloads. A URL-safe mode replaces + and / with - and _ and strips padding so the output can be placed directly in URLs without escaping. Encoding happens client-side with no data ever leaving your device.
JSON
Encoding
Base64
What is JSON to Base64 Encoder?
Kubernetes stores secret values as Base64. JWTs encode their header and payload as Base64URL. Docker registry credentials in config.json are Base64-encoded. HTTP Basic Authentication is Base64. When you need to produce a Base64-encoded JSON value — for a Kubernetes secret manifest, a manual JWT, or an Authorization header — the process is always: minify the JSON, encode to UTF-8 bytes, Base64-encode the result. This tool does all three steps together. Choose between standard Base64 (with + and / characters, for binary contexts) and Base64URL (with - and _ characters, no padding, for URLs and JWT segments). The output is a single-line string with no whitespace, ready to paste directly into a secret manifest's data field, a curl -H "Authorization: Basic ..." header, or a JWT segment.
How to Use
- 1
Paste Your JSON
Paste the JSON object or array you want to encode. The JSON is first minified to remove whitespace, then encoded as Base64. Use the "Preserve Formatting" option to encode pretty-printed JSON.
- 2
Set Encoding Options
Choose between standard Base64 (using + and /) and Base64URL (using - and _, safe for URLs and JWT segments). Toggle padding (= characters) on or off for your target system.
- 3
Encode to Base64
Click "Encode". The JSON is serialised as a UTF-8 string and then encoded using the selected Base64 alphabet. The output is a compact, single-line string with no line breaks.
- 4
Copy the Encoded String
Copy the Base64 string for use in a Kubernetes secret, JWT payload segment, HTTP Authorization header, Docker config.json, or environment variable.
Common Use Cases
HTTP Header Encoding
Encode JSON payloads as Base64 for safe transmission in HTTP headers, URL parameters, or cookie values where raw JSON special characters (quotes, braces) would break the encoding.
Kubernetes Secret Creation
Kubernetes secrets store values as Base64-encoded strings. Encode your JSON credentials, certificates, or config objects to Base64 before adding them to a Kubernetes Secret manifest.
JWT Claim Embedding
Encode JSON claim objects to Base64 for manual JWT construction, debugging, or generating test tokens without a JWT library, using Base64URL encoding for the header and payload segments.
Email & Binary-Safe Transport
Base64-encode JSON payloads for embedding in email bodies, data URIs, or any transport channel that does not safely handle raw Unicode or special characters in JSON strings.
Conversion Examples
JSON Object → Base64 String
The JSON is minified then encoded as a Base64 string for safe transport.
Input JSON
{
"id": 1,
"username": "alice",
"role": "admin"
}Output CSV
eyJpZCI6MSwidXNlcm5hbWUiOiJhbGljZSIsInJvbGUiOiJhZG1pbiJ9
Kubernetes Secret JSON → Base64
Credentials JSON encoded for safe embedding in a Kubernetes Secret manifest.
Input JSON
{
"apiKey": "sk-abc123",
"endpoint": "https://api.example.com",
"timeout": 30
}Output CSV
eyJhcGlLZXkiOiJzay1hYmMxMjMiLCJlbmRwb2ludCI6Imh0dHBzOi8vYXBpLmV4YW1wbGUuY29tIiwidGltZW91dCI6MzB9