Logo
Prompt Minds

Base64 Encode / Decode — Text ⇄ Base64

Convert text to Base64 and Base64 back to text in your browser — UTF-8 safe for every language and emoji, with URL-safe and MIME options.

टेक्स्ट को Base64 में बदलें या Base64 को वापस टेक्स्ट में — हिंदी और इमोजी के साथ भी सही।

100% private — runs in your browser · Last Updated: October 2026
—
Text is encoded as UTF-8, so Hindi, emoji and every language round-trip correctly. Base64 is an encoding, not encryption — anyone can decode it. For images, use Base64 Image.
PDNob logoPDNob Your Lightweight AI-Powered PDF Editor Edit · Convert · Compress · OCR · AI Download for Desktop

Quick Tips

Base64 is not encryption
Output is ~33% larger
Use URL-safe for links and JWTs
Wrap at 76 only for email
Swap to check a round-trip
All Tools
Advertisement

Quick Answer

Base64 turns every 3 bytes into 4 characters from A–Z, a–z, 0–9, + and /, padding with = at the end. "Hello" becomes SGVsbG8=. To decode, paste the Base64 and the tool converts it back to UTF-8 text. It is an encoding for moving data through text-only systems, not encryption — anyone can decode it.

Base64 Encode and Decode Online — Fast, Correct and Private

Base64 shows up everywhere once you start working with web development, APIs or email. Authentication headers, JSON payloads, data URLs, JWT tokens, configuration files and email attachments all use it. Sooner or later you need to turn some text into Base64, or work out what a long string like SGVsbG8sIFdvcmxkIQ== actually says. This free Base64 encoder and decoder does both, instantly, in your browser.

It gets the details right that many quick tools get wrong. Text is converted to UTF-8 before encoding, so Hindi, Tamil, Bengali, Chinese and emoji survive the round trip unchanged. It supports URL-safe Base64url for links and tokens, optional 76-character MIME wrapping for email, and decoding that tolerates spaces, line breaks and missing padding. When the input is not valid, it tells you exactly why instead of showing garbage. Nothing you paste is uploaded anywhere.

How to Use the Tool

  1. Pick a direction. Encode → Base64 turns text into Base64. Decode Base64 → turns Base64 back into text.
  2. Paste or type your input. With Convert as I type on, the result updates live. Turn it off for very large inputs and press Convert when ready.
  3. Choose options if needed. Tick URL-safe for strings that go into URLs, filenames or JWTs. Tick Wrap lines at 76 characters only if a system expects MIME-style output.
  4. Use the result. Copy it, download it as a .txt file, or press Swap to feed the output back as input — a quick way to confirm the round trip is perfect.

How Base64 Works

Computers store data as bytes, and a byte can have any of 256 values. Many of those values are invisible control characters or have special meaning in emails, URLs or JSON. Base64 solves this by using only 64 characters that are safe almost everywhere: the 26 uppercase letters, 26 lowercase letters, 10 digits, and + and /.

The algorithm takes three bytes (24 bits) at a time and splits them into four groups of 6 bits. Each 6-bit group is a number from 0 to 63, which picks one character from the alphabet. So every 3 bytes of input become 4 characters of output — which is why Base64 is about 33% larger than the original.

When the input length is not a multiple of three, the last block is padded. One leftover byte produces two characters plus ==; two leftover bytes produce three characters plus =. You can see this with very short inputs:

TextBytesBase64
M1TQ==
Ma2TWE=
Man3TWFu
Hello5SGVsbG8=
Prompt Minds12UHJvbXB0IE1pbmRz

Why UTF-8 Matters (Hindi and Emoji)

Base64 encodes bytes, not letters. Before text can be encoded, it has to be turned into bytes, and the standard way to do that is UTF-8. English letters take one byte each, but a Devanagari letter takes three, and many emoji take four. The word नमस्ते has six characters but 18 UTF-8 bytes, so its Base64 is 4KSo4KSu4KS44KWN4KSk4KWH — 24 characters.

The browser's built-in btoa() function only handles characters up to code 255, so naive tools either throw an error on Hindi text or silently corrupt it. This tool encodes with TextEncoder first and decodes with a strict UTF-8 decoder, so every language comes back exactly as it went in. If decoded bytes are not valid UTF-8, the tool says so rather than showing broken symbols.

Standard vs URL-safe Base64

The characters +, / and = have special meanings in URLs: + can turn into a space, / separates path segments, and = separates query keys from values. The URL-safe variant, called Base64url in RFC 4648, swaps + for - and / for _, and usually leaves out the padding. For example, the text hello?> is aGVsbG8/Pg== in standard Base64 and aGVsbG8_Pg in Base64url.

JSON Web Tokens use Base64url for each of their three parts, and so do many API keys, signed URLs and OAuth parameters. When decoding, you don't need to tell the tool which variant you have — it accepts both automatically and adds back any missing padding.

Common Uses of Base64

  • HTTP Basic authentication. The header Authorization: Basic … carries username:password in Base64 — which is why it must only be used over HTTPS.
  • Data URLs. Small images and fonts can be embedded directly in HTML or CSS as data:image/png;base64,…. Use our Base64 image tool for that.
  • JWT tokens. The header and payload of a JWT are Base64url-encoded JSON. Our JWT decoder decodes them and shows the expiry time.
  • Email attachments. MIME encodes attachments in Base64 with lines of 76 characters.
  • APIs and config files. Binary values, certificates and keys are often stored as Base64 inside JSON, YAML or environment variables.

Base64 Is Not Encryption

This is the single most important thing to understand. Base64 has no key and no secret: it is a public, reversible transformation, and anyone can decode it in a second with a tool like this one. It provides zero confidentiality. If you find a password, API key or personal data stored "encrypted" in Base64, treat it as plain text. For integrity checks use a hash from our hash generator; for real secrecy use proper encryption with a key, managed by a well-tested library.

Decoding Base64 by Hand: a Worked Example

To see that there is no magic involved, decode TWFu manually. In the Base64 alphabet, T is 19, W is 22, F is 5 and u is 46. Written as 6-bit binary these are 010011, 010110, 000101 and 101110. Joined together they make 24 bits: 01001101 01100001 01101110. Split into bytes, that is 77, 97 and 110 — the ASCII codes for M, a and n. So TWFu decodes to "Man". The tool does exactly this, just millions of times faster, and then reads the bytes as UTF-8.

Base64 in Code

If you need the same result inside a program, most languages have Base64 built in. In JavaScript, browsers provide btoa() and atob(), but they work on "binary strings", so combine them with TextEncoder and TextDecoder for Unicode text — that is what this tool does. Node.js uses Buffer.from(text).toString('base64'), and 'base64url' for the URL-safe form. Python has the base64 module with b64encode, b64decode and urlsafe_b64encode. On Linux and macOS, the base64 command-line tool encodes and decodes files. All of these follow RFC 4648, so their output matches this tool's for the same input and options — making it a convenient way to check what your code should produce.

When Not to Use Base64

Because it adds a third to the size, Base64 is a poor choice for large files. Embedding big images as data URLs makes HTML and CSS heavier and stops the browser caching them separately, so keep data URLs for small icons. Sending large uploads as Base64 inside JSON is slower than a normal file upload. And as covered above, it should never be used as a security measure. Use it for what it is good at: moving small amounts of binary data safely through text-only channels.

A related tip: if a Base64 string looks suspicious — for example in a phishing email or a strange browser extension setting — decoding it here is safe, because the tool only displays the result as plain text and never runs or opens it. That makes it a handy first step when you want to understand what a piece of encoded data actually contains.

Understanding the Error Messages

  • Invalid characters. Base64 only contains letters, digits, +, /, -, _ and =. Anything else — a stray quote, a comma, a non-English letter — means the string was cut or copied wrongly. Spaces and line breaks are ignored automatically.
  • Wrong length. A valid Base64 string, without padding, can never have a length that leaves a remainder of 1 when divided by 4. This usually means a character was lost while copying.
  • Not UTF-8 text. The string decoded fine, but the bytes are a file — often an image or PDF — rather than text. Decode images with the Base64 image tool instead.

Privacy and Performance

Developers often need to decode tokens and config values that contain sensitive information. Pasting those into a random website is risky. This tool runs entirely in your browser using built-in functions — there is no server-side processing, no logging and no upload. It processes input in chunks so that large texts don't overflow the browser, and once the page has loaded it keeps working offline. For encoding special characters in links, see our URL encoder, and for HTML entities the HTML encoder.

Base64 Encode / Decode — Key Facts

"Hello"SGVsbG8=
Size increase≈ 33% (4 chars per 3 bytes)
AlphabetA–Z a–z 0–9 + /
URL-safe- and _ instead of + and /
Padding= or ==
StandardRFC 4648

Frequently Asked Questions

What is Base64?

Base64 is a way to represent binary data using 64 safe text characters (A–Z, a–z, 0–9, + and /). It lets data travel through systems that only handle text, such as email, JSON and URLs.

Is Base64 encryption?

No. Base64 is an encoding with no key — anyone can decode it in a second. Never use it to hide passwords or secrets.

Why does Base64 end with = or ==?

Base64 works in blocks of 3 bytes. When the input isn't a multiple of 3, = signs pad the last block: one = means 2 leftover bytes, == means 1.

How much bigger is Base64?

About 33% larger, because every 3 bytes become 4 characters. Line breaks add a little more.

Does it work with Hindi and emoji?

Yes. Text is converted to UTF-8 bytes before encoding, so नमस्ते and 👋 round-trip correctly. Many simple tools break on these.

What is URL-safe Base64?

Base64url replaces + with - and / with _ and usually drops = padding, so the string can be used in URLs and filenames. JWTs use it.

What is MIME line wrapping?

Email (MIME) Base64 breaks lines every 76 characters. Turn on wrapping if a system expects that format; leave it off for JSON, data URLs and APIs.

Why do I get 'not UTF-8 text' when decoding?

The Base64 decodes to bytes that aren't text — usually an image, PDF or other file. Use Base64 Image for images.

Can I decode a JWT with this?

You can decode each part, but the JWT Decoder is easier: it splits the token, decodes the header and payload, and shows the expiry.

Does it upload my data?

No. Encoding and decoding happen in your browser with built-in functions. Nothing is sent to a server.

Is there a size limit?

No fixed limit — it handles large text in chunks. Very large inputs (many MB) depend on your device's memory.

Is it free?

Yes, completely free with no sign-up.

Encode & Decode Base64!

UTF-8 safe, URL-safe, private — free.

Explore More Prompt Minds Tools

Base64 Encode / Decode works great alongside our other free tools. Every Prompt Minds tool runs entirely in your browser — no sign-up, no uploads, no watermarks. Browse all free tools.

Prompt Minds AI Assistant
Namaste! How can I help you with Base64 Encode / Decode?