Skip to content
SmallEasyTools

Base64 Encode / Decode

Convert text to Base64 and back instantly. Full UTF-8 support means emoji, Bengali, Arabic and every other language work correctly — with a URL-safe option for links, tokens and filenames.

  • Free
  • Runs in your browser
  • No sign-up needed

Free and unlimited · runs entirely in your browser

Rate this tool:
Share: Facebook X LinkedIn WhatsApp Email

Quick answer

To encode text, choose Encode, type or paste your text and the Base64 result appears instantly. To decode, choose Decode and paste a Base64 string to see the original text. Turn on URL-safe to use the - and _ alphabet without padding, as used in URLs, JWT tokens and filenames. Click Copy to copy the result. Everything runs in your browser.

Modes:
Encode and decode
Character support:
Full UTF-8 (emoji, all languages)
Variants:
Standard and URL-safe Base64
Speed:
Instant, updates as you type
Errors:
Clear message for invalid Base64
Upload needed:
No – runs in your browser
Account:
Not required
Price:
Free

Base64 is one of the most common encodings on the internet. It turns any data — text, binary files, images — into a string made only of letters, digits, plus and slash, so it can travel safely through systems that only handle plain text: email, URLs, JSON, XML, HTTP headers and configuration files. You meet Base64 in email attachments, data URIs, API keys, basic authentication headers, JWT tokens and countless developer tools.

Our Base64 encoder and decoder converts in both directions as you type. Unlike many simple tools that break on non-English text, it encodes with full UTF-8 support, so emoji, accented letters and scripts such as Bengali, Hindi, Arabic, Chinese and Cyrillic round-trip perfectly.

The URL-safe option produces the variant defined in RFC 4648 — replacing + with - and / with _ and dropping = padding — which is used in web tokens, URL parameters and filenames. When decoding, the tool accepts both variants and reports clearly if the input is not valid Base64.

All conversion happens in your browser. Nothing you paste is sent anywhere, which matters because Base64 strings often contain configuration, tokens or personal data.

How to encode or decode Base64 – step by step

  1. 1 Choose the modeClick Encode to turn text into Base64, or Decode to turn Base64 back into text.
  2. 2 Paste your inputType or paste the text or Base64 string. The result updates instantly.
  3. 3 Choose URL-safe if neededEnable URL-safe for tokens, URLs and filenames.
  4. 4 Check for errorsIf decoding fails, the tool explains that the input is not valid Base64.
  5. 5 Copy the resultClick Copy and paste it where you need it.

Why use this Base64 tool?

Encode and decode

Both directions in one place.

True UTF-8

Emoji and every language work correctly.

URL-safe variant

For JWTs, URLs and filenames.

Instant results

Converts as you type.

Clear error messages

Know immediately when input is invalid.

Private

Runs locally; nothing is uploaded or logged.

How Base64 works

Base64 takes the input bytes three at a time (24 bits) and splits them into four groups of 6 bits. Each 6-bit value (0–63) maps to one character of the Base64 alphabet: A–Z, a–z, 0–9, + and /. If the input length is not a multiple of three, the output is padded with one or two = signs. That is why Base64 output is always about 33% larger than the input: every 3 bytes become 4 characters. For example, the word "Man" becomes "TWFu", and "Hi" becomes "SGk=".

Standard vs. URL-safe Base64

StandardURL-safe
Characters 62 and 63+ and /- and _
Padding= at the endUsually omitted
Used inEmail (MIME), data URIs, PEM certificates, Basic AuthJWT tokens, URL parameters, filenames, some APIs
Standard Base64 in a URL can break, because + means a space in query strings and / is a path separator. Use URL-safe Base64 there, or percent-encode the standard string with our URL Encoder.

Common uses of Base64

  • Email attachments — MIME encodes files as Base64 so they survive mail servers.
  • Data URIs — embed small images directly in HTML or CSS; create them with Image to Base64.
  • HTTP Basic authentication — the Authorization header contains "username:password" in Base64.
  • JSON Web Tokens (JWT) — header and payload are URL-safe Base64; decode them to read the claims.
  • APIs — many APIs send files, images or binary data as Base64 inside JSON.
  • Configuration — Kubernetes secrets and some config files store values in Base64.

Decoding a JWT token

A JWT looks like three Base64 strings separated by dots: header.payload.signature. Copy the first or second part, choose Decode and URL-safe, and you will see JSON such as the algorithm, user ID and expiry time. Format the JSON with our JSON Formatter to read it easily. The signature part is binary and will not decode into readable text. Remember: decoding a JWT does not verify it — only the server with the secret key can confirm it is genuine.

Base64 is not encryption

Base64 is an encoding, not a security measure. Anyone can decode it instantly, so never use it to "hide" passwords, API keys or personal data. Basic authentication relies on HTTPS for protection, not on Base64. To protect information, use real encryption — for example password-protect documents with Protect PDF — and to check data integrity, use a hash such as SHA-256 from our Hash Generator.

Why UTF-8 matters

The browser's built-in btoa() function only handles Latin-1 characters and throws an error on emoji or non-Latin scripts. Many online tools use it directly and fail with text like "আমি" or "😀". This tool first converts text to UTF-8 bytes and then encodes those bytes, and reverses the process when decoding. The result matches what Python, PHP, Java, Node.js and command-line tools produce for UTF-8 text, so strings can move safely between systems.

Base64 in email and MIME

Email was designed in an era when messages could only contain plain English text, and many mail servers still expect 7-bit characters. MIME, the standard that lets emails carry attachments, images and non-English text, solves this by encoding content as Base64 and splitting it into lines of 76 characters. When you open the raw source of an email ("Show original" in Gmail), you will see long blocks of Base64 for every attachment and often for the message body too, marked with Content-Transfer-Encoding: base64. If you need to read such a block — for example to debug a newsletter template or inspect a suspicious message — copy the lines, remove the headers, and decode them here. Line breaks inside the Base64 are ignored automatically.

Base64 vs. other encodings

Base64 is not the only text-safe encoding. Hexadecimal represents each byte as two characters (0–9, a–f), so it doubles the size but is easy to read for debugging and is common for hashes and colours. Percent-encoding (URL encoding) changes only unsafe characters and keeps normal letters readable, which is why it is used in web addresses. Base32 uses only capital letters and digits, which suits systems that are not case-sensitive. Base64 offers the best balance of compactness and safety for general data, which is why it is used so widely. Convert between binary, hex and text with our Binary Converter.

Base64 on the command line and in code

For reference, developers can do the same conversions in code: in JavaScript use TextEncoder with btoa, in Python base64.b64encode(text.encode()), in PHP base64_encode() and on Linux or macOS the base64 command. The online tool is handy for quick checks, debugging API payloads and decoding values you find in logs without opening an editor.

Troubleshooting

  • "Invalid Base64". The string contains characters outside the alphabet, was cut off, or has extra spaces or line breaks in the wrong place.
  • Decoded text looks like gibberish. The data is binary (an image, a compressed file or encrypted data), not text.
  • Result differs from another tool. Check the variant (standard vs. URL-safe) and padding; some tools also encode line breaks differently.
  • Plus signs disappear in URLs. Use URL-safe mode.

Frequently asked questions

What is Base64 encoding?

A way to represent binary data or text using 64 printable characters so it can travel through text-only systems.

How do I decode Base64?

Choose Decode and paste the Base64 string; the original text appears instantly.

Is Base64 encryption?

No. It is an encoding anyone can reverse. Do not use it to protect secrets.

Does it support emoji and other languages?

Yes. The tool uses UTF-8, so all characters work.

What is URL-safe Base64?

A variant using - and _ instead of + and /, usually without = padding.

Why is Base64 longer than the original?

Every 3 bytes become 4 characters, adding about 33%.

Can I decode a JWT token?

Yes. Paste the header or payload part and use Decode with URL-safe.

Is my data sent to a server?

No. Encoding and decoding run in your browser.

Can I encode files?

This tool is for text. To encode images, use Image to Base64.

What does the = at the end mean?

It is padding added when the input length is not a multiple of three bytes.

Is the tool free?

Yes. No sign-up required.

Can I decode Base64 with line breaks?

Yes. Spaces and line breaks are removed automatically before decoding, so text copied from emails works.

Does it accept URL-safe input when decoding?

Yes. Both standard and URL-safe characters are accepted, with or without padding.

Last updated November 21, 2026 · Written and tested by the SmallEasyTools team.