Base64 Encode and Decode

Convert text to Base64 and back. Encoding turns any text, including Hindi and emoji, into Base64 using UTF-8; decoding turns Base64 back into readable text. A URL-safe option uses - and _ instead of + and / and drops the = padding, as used in web tokens and links. Decoding accepts both forms.

Text

Loading tool…

At a glance

Encode
Text to Base64 using UTF-8; optional URL-safe alphabet without padding
Decode
Standard or URL-safe Base64 to UTF-8 text; spaces and line breaks are ignored
Errors
Invalid characters and non-text (binary) results are reported
Not supported
Encoding files or decoding images

How it works

  1. Choose a direction

    Encode text to Base64, or decode Base64 to text.

  2. Paste your input

    The result updates as you type.

  3. Copy the output

    Use Copy result to paste it where you need it.

Base64 or another encoding?

Different places need different encodings.

OptionBest forTrade-off
Base64 Encode and Decode (this page)Tokens, headers and data that must be plain ASCII.Output is about a third larger than the input.
URL Encode and DecodeValues inside web addresses.Only escapes unsafe characters.
JSON FormatterReading decoded JSON payloads.Decode first, then format.
File Hash (SHA-256)Checking that a file has not changed.One-way; cannot be decoded.
Password GeneratorCreating secrets.Base64 is not protection.

Example: reading the middle part of a token

A JSON Web Token has three parts separated by dots, and you want to read the middle one.

  1. Choose Base64 to text and paste only the middle part, between the two dots.
  2. The decoder accepts the URL-safe alphabet and missing padding, so the JSON payload appears.
  3. Paste the result into the JSON Formatter to read it comfortably.
  4. To go the other way, encode “Hello, SortMyFile!” to get SGVsbG8sIFNvcnRNeUZpbGUh.

When to use Base64 Encode and Decode

Use it when debugging APIs and tokens, reading encoded email or log content, building test requests with Basic authentication, or preparing small text values that must travel safely in URLs and JSON.

How Base64 works

Every three bytes become four characters from a 64-character alphabet, so the output is about a third larger. When the input length is not a multiple of three, = signs pad the end. URL-safe Base64 swaps + and / for - and _ so the value can sit in a link.

Why UTF-8 matters

Older Base64 tools in browsers fail on characters outside Latin-1, such as Hindi. Converting text to UTF-8 bytes first makes every language and emoji encode and decode correctly and match what servers expect.

Not a security measure

Base64 is a reversible encoding, not encryption. Credentials in Basic authentication headers are only Base64-encoded, which is why such requests must always use HTTPS.

Where Base64 shows up

Email attachments, data URLs in web pages, Basic authentication headers and the parts of JSON Web Tokens all use Base64. Recognising it, a long string of letters and digits often ending in = or ==, helps when reading logs and debugging integrations.

Base64 in data URLs

Small images and fonts are sometimes embedded straight into HTML or CSS as data URLs, such as data:image/png;base64,iVBOR... Decoding the part after the comma gives the original file bytes. This tool decodes text only, so binary data like images will show the not-text message instead of garbled characters.

Base64 and email

Email was designed for plain text, so attachments are converted to Base64 for sending and back again on arrival. That is why an attachment makes an email about a third larger than the file itself.

If something looks wrong

It says the input is not valid Base64
Check for characters outside A–Z, a–z, 0–9, +, /, - and _ and the = padding. Copy the value again without quotes.
It says the result is not UTF-8 text
The data is binary, such as an image or a compressed file. Use a tool that saves it as a file.
The encoded result differs from another tool
Some tools encode text with a different character set. This tool always uses UTF-8, the web standard.
A URL-safe value fails elsewhere
Some systems need the = padding. Untick URL-safe to get standard Base64 with padding.

Common questions

Are line breaks in the input a problem?

No. Spaces and line breaks are ignored when decoding.

Can I encode a file?

Not here; this tool works with text.

Is my data sent anywhere?

No.

Is Base64 encryption?

No. Base64 only changes how data is written. Anyone can decode it, so never treat it as a way to hide passwords.

Does it support Hindi and emoji?

Yes. Text is converted to UTF-8 bytes before encoding and decoded as UTF-8.

Can I decode an image?

If the Base64 is an image or other binary file, the decoder says it is not text. This tool handles text only.

Encoding and decoding happen in the page, which matters when the text contains credentials or tokens.