Skip to main content
b64topdf

Base64 Decoder & Encoder

Decode or encode Base64 strings, text encodings, JWTs, JSON payloads, Gzip streams, and images locally in your browser.

Shortcut: Ctrl / Cmd + Enter

Browser Base64 decoder and encoder with zero server uploads

Developers constantly deal with unreadable strings hiding inside API logs, HTTP cookies, or email payloads. Whether you need a fast base64 decoder online for inspecting a suspicious token or an online base64 encoder for converting binary assets into text, doing the work in your browser saves a trip to the terminal. Paste raw strings, data URIs, JSON objects, or JWTs into the tool above to base64 decode or encode data locally without uploading a single byte.

Most quick converters stop at plain ASCII text and choke on real inputs. This online base64 decoder tool doubles as a full base64 encoder decoder, pairing live decoding with character encoding switches, hex dumps, nested layer inspection, and binary file detection.

How this base64 decoder tool handles real inputs

Strict functions like JavaScript's atob() throw an exception the moment they hit a trailing quote or a data: URI header, as noted in the MDN Window.atob() guide. Our base64 decoder cleans outer whitespace, strips matching quotes, removes RFC 2397 data URL prefixes, and converts URL-safe hyphen (-) or underscore (_) characters defined in RFC 4648 Section 5. It also strips escaped \n, \r, or \t sequences copied from logs before restoring missing = padding.

Need to pinpoint an error in a broken string? Leave Lenient Mode unchecked and the decoder flags the exact line and column alongside the offending character with a highlight button. Turn Lenient Mode on when you want to skip invalid bytes and salvage partial output.

Pasted JSON payloads get automatic scanning for up to 200 candidate properties, so you never have to strip out surrounding braces manually. For tokens and layered payloads, the tool recognizes RFC 7519 JSON Web Tokens even when prefixed with Bearer , displays decoded headers plus iat, nbf, and exp timestamps locally, and flags nested Base64 alongside percent-encoded URLs or Gzip streams.

Once decoded, you can peel back nested layers one click at a time using Step Back history, switch character sets between UTF-8 (with BOM detection), UTF-16, UTF-16 BE, ISO-8859-1, ASCII, or Windows-1252, or toggle Pretty-Print for JSON, HTML, or XML. Built-in output search jumps between matches across large payloads. Need byte-level inspection? Open the Hex or Hex Dump tabs to page through raw bytes in 4 KB or 8 KB slices and jump straight to any hexadecimal offset like 0x100.

Inputs larger than 1 MB switch automatically from live typing mode to memory-backed Web Worker decoding with a live progress bar so the browser tab never freezes. When the bytes match any of 27 binary signatures (including PNG, JPEG, ZIP, or PDF), the file panel previews images inline or links directly to our Base64 to PDF converter.

Using the base64 encoder online for text and images

Click the Encode tab when you need to turn readable text or binary files into Base64 strings. Because btoa() fails on multi-byte characters like accented letters or emojis, our base64 encoder converts text to UTF-8, UTF-16, ISO-8859-1, ASCII, or Windows-1252 bytes via TextEncoder first before encoding. Running base64 encode online locally also means sensitive configuration files or private keys never touch a third-party server.

You can drop any file into the upload zone to base64 encode image assets, SVGs, PDFs, or compressed archives straight from disk. Output options let you pick standard +// or URL-safe -/_ encoding, wrap lines at 76 characters for RFC 2045 MIME compatibility, prepend a MIME data URI prefix, or strip trailing = padding for JWT segments. Once encoded, click Swap to Decode to verify round-trip base64 encode decode behavior immediately. For PDF-only workflows or multi-item ZIP batches, try the PDF to Base64 or Bulk Converter tabs.

Browser tool vs Linux command line and Java code

When should you stay in an online base64 decoder instead of writing shell scripts or application code? For one-off debugging, inspecting unknown binary headers across 27 file formats, or peeling apart multi-layer JWTs without installing packages, a browser utility is much faster.

In automated build pipelines or server backends, native tools take over. On Linux and macOS terminals, the GNU coreutils command runs directly inside a shell pipe (echo "SGVsbG8=" | base64 -d handles quick linux base64 decode tasks, while base64 -d file.txt > out.bin covers standard base64 decode Linux file workflows). In backend services, developers use java.util.Base64 from Java 8 (documented in the Oracle Java Base64 API reference), where Base64.getEncoder().encodeToString(bytes) handles standard java base64 encode calls alongside getUrlEncoder() for URL-safe output. Keep in mind that pasting multi-hundred-megabyte server dumps into any browser hits tab RAM limits faster than streaming CLI pipes.

Three checks before running base64 decode online

Before trusting decoded output or passing a generated string into production code, check three things:

  1. Verify the text encoding when characters look garbled. A payload written in Windows-1252 or UTF-16 shows replacement characters if read as UTF-8, so switch the Character Encoding dropdown to inspect the exact bytes.
  2. Remember that JWT decoding here is inspection only. Reading a token's payload requires zero secrets, and our viewer never checks cryptographic signatures.
  3. Match the variant to the destination. Standard +// strings break inside URL query parameters unless you enable URL-safe -/_ encoding first.

Frequently Asked Questions

What is a Base64 decode?

Base64 decoding reverses the RFC 4648 binary-to-text mapping by converting groups of four 6-bit ASCII characters back into three 8-bit binary bytes. When you run a Base64 decode on an encoded string, you recover the exact original data, whether that means readable UTF-8 text, a JSON object, a PNG image, or a PDF document.

Can ChatGPT decode Base64?

ChatGPT can decode short Base64 text snippets in chat, though standard text generation predicts tokens instead of executing exact byte math and often corrupts longer strings or binary files. Uploading a file to ChatGPT's Python Data Analysis environment lets it decode Base64 accurately via Python's base64 module, though local browser decoding keeps private tokens and files off external AI servers.

How do I decode a Base64 file?

Upload or drop your .txt or .json file into the Decode dropzone above (files larger than 1 MB stay safely in browser memory without slowing down the text box), then click Decode. When the decoded bytes represent plain text, JSON, XML, or a JWT, you can view or download the text output; when the tool detects a binary signature like PNG, ZIP, or PDF, it shows a file summary and download button with the matched extension.

What is Base64 and why is it used?

Base64 is a radix-64 encoding scheme defined in RFC 4648 and RFC 2045 that represents arbitrary binary bytes using 64 printable ASCII characters plus = padding. Systems rely on Base64 to carry binary files, images, or structured tokens safely through text-only channels like email attachments, JSON APIs, HTML data URIs, or HTTP headers without mangling control bytes.

Is Base64 safe?

Base64 is an encoding format, not encryption, so it provides zero confidentiality or security on its own. Anyone with a base64 decoder can read a plain Base64 string or a decoded JWT payload in seconds. Never treat Base64 as a way to hide passwords, API keys, or private records; use authenticated encryption for secrecy, and always process sensitive unencrypted strings locally in a browser tool that makes zero server uploads.

What is an example of Base64?

Encoding the 5-byte ASCII word Hello produces the 8-character Base64 string SGVsbG8=. Similarly, the JSON fragment {"alg" encodes in Base64URL to eyJhbGc, which is why so many JSON Web Tokens and Base64-encoded JSON objects start with eyJ.

What does == mean in Base64?

The = and == characters at the end of a Base64 string are padding markers defined in RFC 4648. Because Base64 encodes 3 bytes (24 bits) into 4 six-bit characters at a time, an input whose byte length leaves 1 leftover byte produces two Base64 characters followed by == to fill the 4-character block, while 2 leftover bytes produce three characters followed by a single =.

What does Base64 text look like?

Standard Base64 text looks like a continuous block (or 76-character wrapped lines) made from uppercase A to Z, lowercase a to z, digits 0 to 9, plus (+) or slash (/), often ending with = or ==. URL-safe variants swap + and / for hyphen (-) and underscore (_) (with periods separating the three segments in JWTs), while web assets frequently start with a prefix such as data:image/png;base64,.

Technical references