UltKit

JSON to Base64 Encoder

Turn a JSON file into a single line of Base64 text that survives environment variables, YAML fields and API bodies where quotes, braces and line breaks would cause trouble. Decoding it gives back the exact same bytes.

Data Converter

or drop CSV, TSV, TXT … files here ·

Max 95 MB per file· Up to 20 files· Deleted after 30 minutes

Output

Files are processed on our servers and deleted after 30 minutes.

How to use this tool

  1. 1

    Upload the JSON file

    Add a .json, .jsonl or .ndjson file, such as a service account key or a config. Up to 20 files per batch, 95 MB each.

  2. 2

    Decide on the prefix

    Plain Base64 is set. Turn on Data URI prefix under Advanced settings only if the text goes into an HTML or CSS attribute that expects a data: URL.

  3. 3

    Encode and copy

    Press Convert to Base64 text, download the result and paste the string into your secret store, manifest or request body.

Encoding JSON as Base64 does not change the data; it repackages it as plain letters and digits so it can travel through places that would mangle braces, quotes and line breaks.

Why encode a JSON file as Base64

The typical case is a credentials file. A cloud provider hands you a service account key as a JSON file, and your CI system, hosting dashboard or container platform only offers a single-line text field for secrets. Pasting the raw JSON breaks on the first newline or the first unescaped quote. Encoded as Base64, the same key is one unbroken string that the application decodes at startup.

Base64 itself goes back to email: MIME, defined in RFC 2045 in 1996, used it so attachments could cross mail servers that only carried 7-bit text. The alphabet was later standardized on its own in RFC 4648 in 2006. The cost is size, since every 3 bytes become 4 characters. For images and other binary files, Image to Base64 does the same encoding with a matching data URI. If the receiving tool reads YAML rather than a Base64 field, JSON to YAML may be all you need.

JSON to Base64 example

Compact JSON {"env":"prod","retries":3} and its Base64 encoding
{"env":"prod","retries":3}

eyJlbnYiOiJwcm9kIiwicmV0cmllcyI6M30=

Where Base64-encoded JSON is expected

Places that take JSON only as Base64
OrganisationRequirementSource
Kubernetes SecretsEvery value under data must be Base64; mount a JSON key file by encoding it first.kubernetes.io
GitHub REST APIThe create or update file contents endpoint expects the file, including a .json file, as Base64 in content.docs.github.com
JSON Web Tokens (RFC 7519)The JSON header and claims are each encoded with base64url and joined with dots.—
Email attachments (MIME)A .json attachment is sent with Base64 transfer encoding so it passes text-only mail servers.—
Base64Base 64 encoding · RFC 4648 encoding
A way to write any bytes using 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding. Each group of 3 input bytes becomes 4 output characters, so the text is about a third longer than the file. It is reversible and carries no key, which makes it a transport format, not a security measure.

JSON and Base64 format facts

JSON

JavaScript Object Notation

JSON is a lightweight text format for structured data, popularised by Douglas Crockford in the early 2000s and standardised as RFC 8259 and ECMA-404. It represents objects, arrays, strings, numbers, booleans and null with simple, readable syntax. It is the default format for web APIs, configuration files and data exchange between apps in almost every programming language. It has no comments, dates or schemas built in, and large nested files are hard to read without a viewer.

Compression
–
Transparency
–
Animation
–
Introduced
2001 · Douglas Crockford
JSON converter

BASE64

Base64-encoded text

Base64 is an encoding, defined in RFC 4648, that turns any binary data into a string of 64 safe text characters. It is used to embed images in HTML and CSS as data URIs, to attach files to email, and to send binary data in JSON or XML. Encoding is fully reversible but makes data about 33% larger. Base64 is not encryption and offers no security; anyone can decode it.

Compression
Lossless
Transparency
–
Animation
–
Introduced
–
BASE64 converter

JSON is encoded as Base64 when a structured payload has to ride inside a single string field that cannot take raw quotes and newlines: a CI secret, a Kubernetes manifest, an API's content field or a header value.

JSON to Base64 questions

Is Base64-encoded JSON encrypted?

No. Base64 is an encoding, and anyone can decode it with one command. The Kubernetes documentation itself warns that Secrets are only Base64 encoded and stored unencrypted by default, so protect the encoded string exactly as you would the original key.

Do I need Base64 or base64url for a token or a URL?

Standard Base64, as written here, uses + and / and pads with =. JWTs and URL parameters use the base64url alphabet from RFC 4648, which swaps in - and _ and usually drops the padding. Replace those three characters if your target expects base64url.

Should I minify the JSON before encoding it?

Usually yes. Spaces, indentation and line breaks are bytes like any other, and every 3 bytes become 4 characters of output. Compacting a pretty-printed config first, for example with jq -c, shortens the encoded string accordingly.

How do I decode the string back to JSON?

On macOS or Linux run base64 --decode, in PowerShell use [Convert]::FromBase64String, and in a browser pass the result of atob through a TextDecoder so UTF-8 characters come back correctly.

Why does kubectl report illegal base64 data?

The value under data in a Secret manifest must be valid Base64 on one line. The error usually means a line break slipped in while pasting, or plain JSON was put under data. Plain values belong under stringData, which Kubernetes encodes for you.

Does encoding change anything inside my JSON?

No. Base64 maps bytes to text and back without loss, so keys, values, accented characters and even a byte order mark at the start of the file are restored exactly on decoding.