Developer · Free tool

Base64 Encoder & Decoder – Text, Files & Images

Free Base64 encoder and decoder. Convert text, files and images to Base64 or data URIs and back, with URL-safe, UTF-8 and padding options. Private.

Instant resultsPrivate by defaultNo sign-up
Text
69 B · 2 linesDrop a file (up to 10 MB)
Base64+33% size
92 charsEditable · converts back to the input
69 BInput bytes
92Output characters
+33%Size change
UTF-8 textDetected content

Type in either box — the other converts live. Everything runs in your browser; nothing is uploaded.

About this tool

A free, private Base64 encoder and decoder for text, files and images. Type or paste text to encode it as Base64 instantly, or paste a Base64 string or data: URI to decode it back to readable text. Choose the standard or URL-safe alphabet, keep or drop = padding, wrap lines at 64 or 76 characters for PEM and MIME, and switch between UTF-8 and Latin-1. Drop any file up to 10 MB to turn it into Base64, a data URI, an HTML <img> tag, a CSS background or Markdown image. When decoded data is an image, PDF or other file, the tool recognises the format, previews images and lets you download the original file. Conversion runs entirely in your browser; nothing is uploaded.

Features

Live encode and decode

Results update as you type, with no button to press. Switch direction at any time or swap the result back into the input.

Two-way editing

Both boxes are editable. Paste Base64 into the result box and the decoded text appears in the input, or edit decoded text and the Base64 updates.

JWT decoder

Paste a JSON Web Token, with or without “Bearer”, to read its header and payload as formatted JSON, with issued and expiry times. The signature is shown but not verified.

Readable JSON

Decoded JSON is pretty-printed with two-space indentation; turn Format JSON off to see the exact decoded text.

Focus on one box

Maximize the input or the result for long payloads; the other box folds into a side strip. Click the strip or press Esc to return to the split view.

Standard and URL-safe Base64

Encode with the RFC 4648 standard alphabet (+ and /) or the URL- and filename-safe alphabet (- and _). Decoding accepts both automatically.

Padding and line wrapping

Keep or remove trailing = padding, and wrap output at 64 characters for PEM certificates or 76 characters for MIME email.

Full Unicode support

Text is encoded as UTF-8, so accents, non-Latin scripts and emoji round-trip correctly. Latin-1 is available for legacy systems.

File and image to Base64

Drop or open any file up to 10 MB and get Base64, a data URI, an HTML <img> tag, a CSS background-image rule or a Markdown image.

Base64 to image and file

Decoded PNG, JPEG, GIF, WebP, SVG, PDF, ZIP, audio, video and font files are detected from their signature bytes, previewed when they are images and downloadable with the right extension.

Precise error messages

Invalid characters are reported with their exact position and can be highlighted in the input. Truncated input and misplaced padding are explained in plain English.

Forgiving decoder

Spaces, line breaks, missing padding and a data:…;base64, prefix are handled automatically, so you can paste Base64 straight from emails, logs or source code.

Hex input and output

Encode raw bytes written as hex, or inspect decoded output byte by byte as hexadecimal.

Private by design

Encoding and decoding happen in your browser. Your text and files are never uploaded, and your option choices are remembered on this device only.

What is Base64 encoding?

Base64 is a way of writing any binary data, such as an image, a PDF or text in any language, using only 64 safe ASCII characters: A–Z, a–z, 0–9, + and /. It exists because many systems, including email, JSON, XML, URLs and HTTP headers, were designed to carry text and can corrupt raw bytes. Encoding data as Base64 lets it travel through those systems unchanged.

The trade-off is size. Every 3 bytes of input become 4 Base64 characters, so encoded data is about 33% larger than the original, plus a little more when lines are wrapped. The statistics under the editors show the exact size change for your input.

How Base64 encoding works

The encoder reads the input 3 bytes (24 bits) at a time and splits those bits into four 6-bit groups. Each 6-bit value, from 0 to 63, is replaced by one character from the Base64 alphabet. When the input length is not a multiple of 3, the last group is completed with zero bits and one or two = padding characters are added so the output length is a multiple of 4.

Text is first converted to bytes using a character encoding. This tool uses UTF-8 by default, which is what browsers, APIs and most programming languages expect, so the encoded result matches btoa on ASCII text, Buffer.from(text).toString("base64") in Node.js and base64.b64encode in Python.

Text:    M        a        n
Bytes:   01001101 01100001 01101110
6-bit:   010011 010110 000101 101110
Index:   19     22     5      46
Base64:  T      W      F      u   →  TWFu
The word “Man” is three bytes, which become exactly four Base64 characters with no padding.

Standard vs URL-safe Base64

Standard Base64 uses + and /, which have special meanings in URLs and file paths. The URL-safe variant defined in RFC 4648 section 5, often called base64url, replaces them with - and _ and usually omits the = padding. JSON Web Tokens (JWT), many OAuth parameters and some file-naming schemes use base64url.

Choose URL-safe and turn Padding off when the output goes into a URL, a cookie or a JWT. The decoder accepts both alphabets and missing padding, so you never need to convert a base64url string before decoding it.

  • Standard: Pz8/Pw== (uses /, +, =)
  • URL-safe: Pz8_Pw (uses _, -, no padding)

Convert an image to Base64 or a data URI

To embed an image directly in a web page or stylesheet, choose Encode, select Encode a file or drop the image onto the input, then pick Data URI, HTML <img>, CSS or Markdown as the output format. The tool detects the image type and builds a ready-to-paste snippet such as data:image/png;base64,iVBORw0KGgo….

Data URIs save an HTTP request, which helps for small icons and placeholders, but they cannot be cached separately and grow the page by a third of the file size. For images larger than a few kilobytes, a normal image file is usually faster.

To go the other way, choose Decode and paste the Base64 string or data URI. If the bytes form an image, PDF or another known file, a preview and a download button appear instead of unreadable text.

Base64 is encoding, not encryption

Anyone can decode Base64 in an instant, so it offers no confidentiality. HTTP Basic authentication headers, Kubernetes secrets and JWT payloads are Base64-encoded for transport, not protected. Never rely on Base64 to hide passwords, API keys or personal data; use real encryption such as TLS or AES and keep secrets in a secret manager.

How to use it

  1. Choose Encode to turn text, hex bytes or a file into Base64, or Decode to turn Base64 or a data: URI back into text or a file.
  2. Type, paste or drop your input, or type into the result box to convert the other way. Both boxes stay in sync as you type; adjust the alphabet, padding, line wrapping, character set or output format above them.
  3. Copy either box, download the result as a file, maximize a box for long data, or select Swap to move the result into the input and reverse the direction.

Common uses

  • Decode Base64 API payloads, JWT segments, email attachments and configuration values
  • Embed small images, icons and fonts in HTML, CSS or Markdown as data URIs
  • Encode credentials for HTTP Basic auth headers or binary data for JSON and XML

Common questions

How do I decode a Base64 string?

Select Decode and paste the string into the input. The decoded text appears immediately. If the data is a file such as an image or PDF, you can preview it and download it with the correct extension.

Why is my Base64 output longer than the input?

Base64 represents every 3 bytes with 4 characters, so the output is about 33% larger. Non-ASCII characters such as é or emoji take 2–4 bytes in UTF-8 before encoding, which increases the size further.

What do the = signs at the end mean?

They are padding. They make the encoded length a multiple of 4 when the input length is not a multiple of 3. One = means the last group held 2 bytes and == means it held 1 byte. Padding can be omitted; this decoder works with or without it.

Why does decoding show an invalid character error?

Base64 may contain only A–Z, a–z, 0–9, + and / (or - and _) plus = at the end. Quotes, commas, a non-breaking space or a stray character copied with the string cause the error. Select Highlight the problem to jump to the exact character.

Does it support Unicode and emoji?

Yes. Text is encoded as UTF-8, so every language and emoji round-trips correctly. The browser's btoa function fails on such characters, which is a common source of errors this tool avoids.

What is the difference between Base64 and base64url?

base64url replaces + with - and / with _ so the result is safe in URLs and file names, and it usually drops the = padding. It is used by JWTs and many web APIs. Choose URL-safe in the options to produce it.

Can I decode a JWT with this tool?

Yes. Choose Decode and paste the token. The header and payload are decoded from base64url and shown as formatted JSON, with the issued, not-before and expiry times converted to dates. The signature is not verified, so never trust a token's contents without checking it on your server.

Can I type into the result box?

Yes. Both boxes are editable and stay in sync. Paste Base64 into the result box while encoding and the decoded text appears in the input; edit decoded text while decoding and the Base64 input updates. Binary data and decoded JWTs are shown read-only.

Is Base64 secure for passwords?

No. Base64 is a reversible encoding, not encryption, and anyone can decode it. Use it to transport data, not to protect it.

Are my text and files uploaded?

No. Encoding and decoding run in your browser using JavaScript. Files are read locally and nothing is sent to TheVanTool's servers.

What is the largest file I can convert?

Files up to 10 MB. Very long results are shown as a truncated preview to keep the page responsive, but Copy and Download always include the complete output.

Can’t find the tool you need?

Tell us what you’d like it to do. We’ll review your suggestion for a future tool.

Suggest a toolOpens your email app. You can also write to [email protected].