Base64 Encoder & Decoder Online for Text and Files

Encode or decode Base64 in seconds. Supports UTF-8 text, URL-safe Base64 and files, right in your browser.

Processed locally in your browser
Base64 input0 characters
Drop a file here

Choose a binary file to encode, or a Base64 text file to decode

No file selected
Decoded output0 characters
Enter Base64 or load a sample to begin.

Conversion Settings

Uses CRLF line endings when enabled.

UTF-8 text • binary-safe file encoding • RFC 4648 alphabet← All Developer Tools
Important: Base64 is an encoding format, not encryption. Do not use it to protect passwords or sensitive information. Text decoding requires valid UTF-8; binary content should be downloaded as a file.
Base64 conversion guide

Encode and Decode Base64 Online: Everything You Need to Know

Need to decode a Base64 string or convert readable text into Base64? Use the Base64 Encoder & Decoder above to switch between plain text and Base64, work with Unicode characters, and handle URL-safe encoding. The guide below explains the format, shows correct examples, and helps you understand common decoding errors.

Base64 is useful when an application needs to represent binary data using printable text characters. It appears in web APIs, email attachments, data URLs, and other text-oriented systems. However, Base64 does not encrypt or protect information.

The basics

What Is Base64 Encoding?

Base64 encoding is a method of representing bytes using a set of 64 printable characters. It translates binary information into a text form that can be handled by systems designed for text. The format is defined by RFC 4648.

Standard Base64 uses uppercase letters A–Z, lowercase letters a–z, digits 0–9, plus +, and slash /. An equal sign (=) may appear at the end as padding. Because Base64 works with bytes rather than characters, the original text should first be converted into bytes using a character encoding such as UTF-8.

Base64 encoding

Converts original bytes into Base64 characters that can be copied, stored, or transmitted as text.

Hello → SGVsbG8=

Base64 decoding

Converts the Base64 representation back into the original bytes, which can then be interpreted as text or saved as a file.

SGVsbG8= → Hello
Remember: Base64 is an encoding, not encryption, hashing, or compression. Anyone who obtains a standard Base64 value can decode it without a secret key.
Quick instructions

How to Encode and Decode Base64 Online

Encode text to Base64

1

Select Encode in the converter above.

2

Paste or type the text you want to convert. For example, Hello World.

3

Run the conversion and check the Base64 output.

4

Copy the encoded string or save it using the tool’s available download option.

Decode Base64 to text

1

Select Decode in the converter above.

2

Paste a Base64 value, such as SGVsbG8gV29ybGQ=.

3

Run the decoder to recover the original bytes.

4

Read the decoded UTF-8 text or download the bytes if the value represents a file.

Use the Swap action when you want to reverse a conversion. If you are working with a URL token or JWT segment, choose URL-safe Base64 rather than assuming standard Base64 is always appropriate.

Practical reference

Base64 Encoding and Decoding Examples

These examples use UTF-8 for the original text. Notice that encoded output does not resemble the input, even though the conversion is reversible.

Original textBase64 valueWhat it illustrates
HiSGk=Two-byte ASCII input
HelloSGVsbG8=Ordinary text conversion
Hello WorldSGVsbG8gV29ybGQ=Text containing a space
ManTWFuThree bytes require no padding
✓4pyTUTF-8 Unicode character
😀8J+YgA==Multibyte emoji

Why does Base64 end in = or ==?

Base64 processes input bytes in groups of three and emits characters in groups of four. If the final input group contains only one or two bytes, standard Base64 pads the output with == or = to complete the final group. The padding does not add original data.

How Base64 converts bytes into characters

Three 8-bit bytes make 24 bits. Base64 splits those bits into four 6-bit values and maps them to characters in its alphabet.

3 bytes × 8 bits = 4 groups × 6 bits

For example, Man becomes TWFu. Standard Base64 output is approximately 33% larger than the original byte sequence before optional line breaks or other overhead. More precisely, for n input bytes, padded output contains 4 × ceil(n / 3) characters.

Developer formats

Base64 vs Base64URL: What’s the Difference?

Base64URL is a variation of Base64 designed for URLs and filenames. It uses the same underlying byte-to-text conversion but substitutes two alphabet characters. The difference is especially useful when encoded values appear in web addresses or JWT segments.

FeatureStandard Base64Base64URL
Character 62+-
Character 63/_
PaddingUsually = when neededMay be omitted by the containing format
Typical useGeneral text and binary encodingURLs, filenames, JWT segments
Developer tip: Base64URL is not the same thing as URL percent-encoding. When encoding query parameters, use the format required by the receiving application. JWT segments commonly use unpadded Base64URL.

UTF-8 Base64 encoding and international text

Text is made of characters; Base64 encodes bytes. With UTF-8 encoding, the same tool can work with English, Urdu, Arabic, Hindi, Japanese, and emojis. For example, the emoji 😀 uses four UTF-8 bytes before Base64 conversion.

In JavaScript, calling btoa() directly on arbitrary Unicode text may throw an error because it expects a byte-oriented string. A robust implementation first converts Unicode text with TextEncoder, then applies Base64 to the resulting bytes. The reverse operation uses TextDecoder for readable UTF-8 text. See MDN’s btoa() documentation.

Beyond text

How to Convert Files to and from Base64

Base64 can represent images, PDFs, text documents, and other files because it operates on bytes. When you encode a file, the result is a Base64 string. When you decode that string, you recover bytes that should be saved in the appropriate file format.

Text files

Encode a local .txt file, copy its Base64 value, or decode the value back into readable text.

Images

An image’s bytes can be encoded into Base64. A data URL also includes a media type such as image/png.

PDF and binary files

Decoded bytes may not be readable as text. Download them as a binary file rather than interpreting them as UTF-8.

Can Base64 store an image directly in HTML?

Yes. A data URL can embed a small Base64-encoded image using a structure such as data:image/png;base64,.... The prefix identifies the media type and encoding, while the remainder carries the image data. It can be convenient for small embedded assets, but large inline images increase document size and may reduce caching flexibility.

For ordinary text encoding, choose the text mode. For file conversion, use the file controls in the tool above when available and respect the interface’s file-size limit. Do not assume that every Base64 value represents UTF-8 text.

Troubleshooting

Common Base64 Decode Errors and How to Fix Them

If your Base64 string does not decode, check its alphabet, padding, input length, and whether the decoded bytes are actually text.

ProblemLikely causeWhat to try
Invalid character errorThe string contains characters outside the selected Base64 alphabetCheck for typos, punctuation, or use of standard vs URL-safe characters
Incorrect padding= is misplaced or the selected format expects different paddingUse the correct padded or permitted unpadded mode
Impossible input lengthThe unpadded character count is one more than a multiple of fourLook for missing or extra characters
Unreadable decoded textDecoded bytes are binary or do not form valid UTF-8 textDownload the original bytes or identify the correct character encoding
Spaces replace plus signsA Base64 string was passed through a URL/form decoderRestore the value or use Base64URL when the receiving format permits it
Unexpected prefixInput contains data:...;base64,Use a data-URL-aware decoder or extract the Base64 portion
Be careful with automatic fixes. Adding missing padding can help when the input is valid unpadded Base64, but it cannot repair lost bytes, arbitrary corruption, or an incorrect character set.
Real-world applications

Where Is Base64 Encoding Used?

Web APIs and JSON

Base64 can carry bytes inside JSON string fields when an API contract requires it. JSON itself does not require Base64 for ordinary text.

Email attachments

MIME email can use Base64 to represent attachment bytes. MIME-specific line wrapping is different from RFC 4648’s default no-wrap rule.

Data URLs

Browsers can display certain resources from data: URLs that embed Base64 content, such as small images.

JWT tokens

JWT header and payload segments typically use Base64URL. Decoding them lets you read the bytes but does not verify the token’s signature or trustworthiness.

Is Base64 safe for sensitive data?

Base64 does not provide confidentiality. A Base64-encoded password, API token, or private document is still sensitive and can be readily decoded. Use HTTPS in transit, suitable encryption when confidentiality is required, and proper secret storage. Encoding alone is not a security measure.

Common questions

Base64 Encoder & Decoder FAQs

What is the difference between Base64 encode and decode?
Encoding converts bytes into a Base64 text representation. Decoding reverses that representation to recover the original bytes. If those bytes represent UTF-8 text, the decoder can display readable characters.
How can I decode Base64 to plain text online?
Select Decode in the tool above, paste your Base64 string, and run the conversion. If the decoded bytes are valid UTF-8, you can read and copy the text. Otherwise, you may need to download the result as a binary file.
Is Base64 encoding the same as encryption?
No. Base64 is a reversible representation of bytes and requires no secret key to decode. Encryption uses cryptographic algorithms and appropriate keys to protect confidentiality.
Why does Base64 sometimes end with one or two equal signs?
Standard Base64 pads its final four-character group with = or == when the original byte count is not divisible by three. The padding describes the incomplete last group rather than additional data.
Does Base64 support emoji, Urdu, and other Unicode text?
Yes, when the text is first encoded into bytes using an encoding such as UTF-8. A decoder must use the matching character encoding to display the recovered bytes correctly.
Can I decode Base64 without uploading it to a server?
Yes, browser-side Base64 tools can perform encoding and decoding locally. Whether any particular website sends entered data to a server depends on its implementation and surrounding scripts. Avoid pasting secrets into untrusted websites.
What is Base64URL used for?
Base64URL substitutes – for + and _ for /, making its alphabet more convenient in URLs and filenames. Some protocols also omit padding. JWT segments commonly use Base64URL.
Why is my Base64 string invalid?
It may contain characters outside the chosen alphabet, missing data, misplaced padding, or an invalid length. It may also be a valid encoded binary file that cannot be displayed as UTF-8 text.
Does Base64 increase file size?
Yes. For standard padded Base64, every three source bytes normally become four characters. The output is about 33% larger for sufficiently large inputs, excluding any extra line breaks or metadata.
Can Base64 decoding verify a JWT signature?
No. Decoding a JWT header or payload only reads the encoded content. Authenticating a JWT requires validating its signature and relevant claims with the correct cryptographic verification process.

Technical reference: RFC 4648, Base-N Encodings; MDN, Window.btoa().