JSON to Base64 Converter Online
Encode JSON into Base64 or decode Base64 back into JSON, with URL-safe output, optional padding removal and a live overhead percentage.
How to Convert JSON to Base64
Paste JSON or a Base64 string, choose a direction, then read the encoded result and copy or download it in one step.
Trin 1
Paste Your Input
Add a JSON document on one side or a Base64 string.
Trin 2
Pick a Direction
Switch between encoding and decoding with the swap button.
Trin 3
Copy the Output
Take the result to your clipboard or download it as text.
Encode Payloads for Headers, URLs and Tokens Without a Server Round Trip
Base64 exists for one reason: to move bytes through systems that only accept text. A JSON payload cannot sit raw inside a URL, an HTTP header, an HTML attribute or a JWT segment, because quotes, braces and newlines all mean something to whatever is reading them. Encoding the payload into the sixty-four printable characters of the Base64 alphabet makes it inert, so it survives the trip intact and can be decoded back into exactly the same document at the other end, with no loss and no ambiguity about where a value stopped.
The cost is size. Every three bytes become four characters, so encoded output is roughly a third larger than the input before any other processing happens. The tool reports that overhead as a real figure rather than leaving you to guess, which is useful when a header, a cookie or a query string has a length limit you are close to hitting. Minifying before encoding recovers part of the difference for free.
Standard Base64 uses plus and slash, both of which are special characters in a URL, and pads the output with equals signs. URL-safe Base64, defined in RFC 4648, swaps those two characters for dash and underscore and often omits the padding entirely. JWTs, URL parameters and filenames all expect the URL-safe variant, so the tool offers both and lets you drop the padding when the consumer expects it.
Decoding is the direction people forget exists until they need it. Paste a Base64 string, switch direction, and the tool decodes the bytes, parses them as JSON and presents a formatted document, which is the fastest way to inspect a JWT payload or a header value you copied out of a request. Invalid input is reported clearly instead of producing garbage that merely looks like a result.
Non-ASCII text is where naive implementations break. The browser’s raw btoa function throws on any character outside a single byte, so one accented letter or emoji is enough to fail the whole conversion. This tool converts the text to UTF-8 bytes first and then encodes those bytes, so Unicode survives the round trip in both directions. Everything happens locally, and no request ever carries your payload anywhere.
Both Directions
Encode JSON to Base64 or decode Base64 back to JSON.
URL Safe Mode
Swap plus and slash characters for dash and underscore instead.
Drop the Padding
Omit the trailing equals signs when a consumer expects it.
Minify First
Strip whitespace before encoding so the output stays much smaller.
Data URI
Wrap the encoded bytes in a ready-to-use data URI string.
Overhead Report
See the exact size cost that Base64 encoding always adds.
Ofte stillede spørgsmål
Ofte stillede spørgsmål
No. Base64 is an encoding, not encryption, and anyone can reverse it without a key. Use it to make data safe to transport through text-only channels, never to hide a secret. Encrypt anything that genuinely needs to stay confidential before you encode it.
Three input bytes become four output characters, a fixed expansion of roughly thirty-three percent. The tool reports that overhead as a real number so you can see the cost before committing the value to a header, cookie or query string with a length limit.
Whenever the encoded value will appear in a URL, a query parameter, a filename or a JWT segment. Standard Base64 uses plus, slash and equals, all of which are special characters in a URL, while the URL-safe alphabet swaps them for dash and underscore.
Yes, and many consumers expect it omitted. The option drops the trailing equals characters, and the decoder re-pads automatically when you paste an unpadded string back in, so a round trip works whether padding is present or not.
Yes. The text is converted to UTF-8 bytes before encoding, so multi-byte characters survive intact. Raw btoa would throw on anything outside a single byte, which is the usual reason a hand-rolled encoder fails on real-world content.
Yes. Paste the middle segment of the token, switch the direction to Base64 to JSON, and the decoded document is formatted for reading. Treat the result as readable rather than trusted, since a JWT signature is what proves the payload was not altered.
It wraps the encoded bytes in a complete data URI prefix, ready to paste straight into an HTML attribute, a CSS rule or a markdown image reference. Small embedded assets are the usual case, since the size overhead makes it a poor fit for large files.
No. Encoding and decoding run in JavaScript inside your browser using the standard text and byte APIs, and no request carries your data. That matters because the payloads people encode here are often headers, tokens and credentials.
Yes, and it is on by default. Whitespace outside strings contributes nothing to the decoded result, so stripping it first produces a shorter encoded string for exactly the same data. Turn it off if you need the encoded text to match a document byte for byte.
