Skip to content

Online Base64 Decoder & Encoder

Encode text to Base64 or decode it back, switch to URL-safe base64url, and convert PDFs, images or any file to Base64 and data: URIs, all inside this browser tab.

100% Free • No Signup • Zero Uploads (Runs Locally)

100% Local Browser Execution • Zero Server Uploads • Air-Gap Safe

100% Local Tool Execution • Tool Inputs Never Leave Your Browser btoa/atob + File API

CtrlEnter to copy output

Wrong result, broken layout or an idea? Tell us about this tool.

Online Base64 Decoder & Encoder Base64 6-Bit Encoding and File Signature Detection & Security Architecture Banner

This online Base64 decoder and encoder converts text to Base64 and back, handles URL-safe base64url and data: URIs, and turns any file, a PDF, an image or a certificate, into Base64 without uploading it. Decoded output is checked against common file signatures, so a pasted blob that is really a PDF, ZIP or Windows executable is labelled before you save it. Everything runs with the browser’s btoa, atob and File APIs in this tab.

How Base64 encoding works

Base64 (RFC 4648) splits input bytes into groups of three (24 bits) and writes each 6-bit slice as one of 64 printable characters: A–Z, a–z, 0–9, + and /. A final group of one or two bytes is padded with =. The output is always about 33% larger than the input: 3 bytes become 4 characters.

Base64 is an encoding, not encryption. Anyone can decode it, so a Base64 string in a config file or HTTP header is as readable as plain text. Treat Authorization: Basic values and Kubernetes Secrets as secrets, not as protected data.

How it works: Base64 Encoder & Decoder

Online Base64 Decoder & Encoder Base64 6-Bit Encoding and File Signature Detection & Security Architecture Diagram. Diagram of Base64 encoding: three input bytes split into four 6-bit groups mapped to the Base64 alphabet, with padding, base64url and data: URI variants, and file signature detection on decode.
Diagram of Base64 encoding: three input bytes split into four 6-bit groups mapped to the Base64 alphabet, with padding, base64url and data: URI variants, and file signature detection on decode.

Standard Base64, base64url and MIME line wrapping

The same bytes can be written in a few accepted forms. The decoder accepts all of them; the encoder lets you pick.

  • Standard (RFC 4648 §4): + and / with = padding, used in email, PEM and most APIs.
  • base64url (RFC 4648 §5): - and _ without padding, used in JWTs, URLs and file names.
  • MIME (RFC 2045): standard alphabet wrapped at 76 characters per line, used in email attachments.
  • data: URI (RFC 2397): data:application/pdf;base64,…, used to embed images and PDFs in HTML, CSS and JSON.

Converting a PDF or image to Base64

Drop the file in the File to Base64 tab. It is read with File.arrayBuffer() and encoded in memory, so contracts, invoices and ID scans never leave your device. Turn on data: URI to get a string you can paste into an <img src>, an <iframe> or a JSON API field that expects an embedded document.

Going the other way, paste Base64 or a data: URI into Decode Base64. The tool reports the size and detected type (PDF, PNG, JPEG, GIF, ZIP, gzip, MZ or ELF executable) and offers a download with the right extension. Binary content is never rendered or executed.

Base64 in security investigations

Attackers use Base64 to smuggle payloads past simple filters: PowerShell -EncodedCommand, HTML smuggling with data: URIs, and MIME attachments in phishing mail. A decoded blob that starts with MZ is a Windows executable and %PDF is a PDF. For layered obfuscation such as gzip inside Base64 inside PowerShell, use the [log deobfuscator](/tools/log-deobfuscator/), which decodes recursively.

Base64 quick reference

Signatures and sizes you will meet when decoding Base64.
Base64 starts withDecoded bytesMeaning
JVBERi0%PDF-PDF document
iVBORw0KGgo\x89PNGPNG image
/9j/FF D8 FFJPEG image
UEsDBAPK\x03\x04ZIP, DOCX, XLSX, JAR
H4sI1F 8B 08gzip stream
TVqQMZWindows executable or DLL
eyJ{"JSON, often a JWT segment

Signatures and sizes you will meet when decoding Base64.

Command-line examples

Encode and decode on Linux or macOS

base64 -w0 file.pdf > file.b64   # macOS: base64 -i file.pdf
base64 -d file.b64 > file.pdf

Encode a file in PowerShell

[Convert]::ToBase64String([IO.File]::ReadAllBytes("file.pdf"))

Decode with OpenSSL

openssl base64 -d -A -in file.b64 -out file.pdf

Frequently asked questions

Use a decoder that runs in your browser, like this one. The string is decoded locally and never sent to a server, which matters for tokens, keys and customer data.