JSON to Base64

Input
Output

JSON to Base64

Turn JSON into one Base64 string you can put where only plain text fits: a Kubernetes secret, a CI variable, an HTTP header or a URL. The JSON is minified first, so the result is as short as it can be.

Example: a config for a CI secret

CI systems and Kubernetes secrets keep values as single-line text, so a JSON config is usually stored as Base64. The JSON is minified first, which is why the result is shorter than encoding the pretty-printed text:

Input

{
  "apiUrl": "https://api.example.com",
  "retries": 3,
  "features": {
    "search": true,
    "export": false
  }
}

Output

eyJhcGlVcmwiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsInJldHJpZXMiOjMsImZlYXR1cmVzIjp7InNlYXJjaCI6dHJ1ZSwiZXhwb3J0IjpmYWxzZX19

How do I use the JSON to Base64?

  1. Paste JSON (or any text).
  2. Pick standard or URL-safe Base64, and whether to encode the whole input or each item.
  3. Copy the Base64.

What does the JSON to Base64 do?

  • JSON minified before encoding
  • Standard and URL-safe (Base64URL) alphabets
  • Each array item or line encoded on its own if you want

When to use the JSON to Base64

Base64 turns any bytes into letters, digits and two symbols, so data can travel where only plain text is allowed. JSON gets encoded this way all the time: Kubernetes secret values, CI and cloud secret variables, HTTP headers such as an encoded user context, data: URIs and fields inside other JSON.

Bracely minifies the JSON before encoding, so the result is as short as it can be, and encodes text as UTF-8, so ₹ or é survive the round trip. Standard Base64 uses + and / and = padding; pick the URL-safe alphabet (Base64URL: - and _, no padding, as JWTs use) when the value goes into a URL, a cookie or a file name. Each item encodes every array item or line on its own, for a list of secrets.

Frequently asked questions

Is Base64 encryption?
No. Anyone can decode it, here or with base64 -d. It only changes how the bytes are written. To keep a value secret, encrypt it (Encrypt text or Encrypt fields) and then encode it if it still has to be text.
How do I put it in a Kubernetes secret?
Use the Base64 as a value under data: in the Secret's YAML. kubectl create secret generic does the same encoding for you from a file or a literal.
Is my data uploaded?
No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.

More JSON tools

Bracely has 104 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.1 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram