Free Developer Tool

Base64 Encode: Convert Text to Base64 Online

Type or paste any text and get a clean Base64 string instantly. UTF-8 safe, with an optional URL-safe mode. Free, no signup.

Text to Base64 UTF-8 safe URL-safe output Line-by-line mode One-click copy Runs in your browser No signup

Encode Text to Base64 in One Click

Need to drop text into a JSON field, an HTTP header or a data URL without it breaking? Base64 is the usual fix. Paste your text, click Encode, and this Base64 encoder hands you a string made only of safe characters, ready to copy.

Read more
Three bytes rewritten as four Base64 characters

What Is Base64 Encoding?

Base64 encoding takes raw bytes and rewrites them with 64 characters: A–Z, a–z, 0–9, + and /. Every 3 bytes become 4 characters, so the output is about a third longer than the input. In return, it survives email systems, URLs and text-only formats that would otherwise mangle the data. For example, Hello encodes to SGVsbG8=.

Accents, non-Latin scripts and emoji encoded correctly as UTF-8

UTF-8 Safe for Every Language

Your text is converted to UTF-8 before it's encoded, so accents, non-Latin scripts and emoji come out right. That's where a lot of quick scripts trip up: JavaScript's built-in btoa() throws an error on characters it can't handle, like most emoji.

URL-safe Base64 using - and _ with no padding

URL-Safe Base64 for Links and Tokens

Standard Base64 uses + and /, which mean something special inside a URL. Turn on URL-safe output to swap them for - and _ and drop the = padding. That's the format JSON Web Tokens and many APIs expect.

List of values each encoded to its own Base64 line

Encode a List Line by Line

Turn on Encode each line separately to process a whole list in one go: usernames, IDs or short strings. Each line gets its own Base64 value, in the same order you pasted them.

Small image converted to a Base64 data URI

Encoding Images and Files

Want to embed a small icon in your CSS or HTML? Pictures need a file upload rather than a text box, so use our Image to Base64 converter. It gives you a ready-made data URI you can paste straight into your code.

Base64 used for transport but not for protecting data

When to Use Base64 (and When Not To)

Use it to move data through text-only channels: email attachments, Basic Auth headers, small inline images and API payloads. Don't use it to protect anything. Base64 isn't encryption, and anyone can reverse it with a Base64 decoder in a second.

How to Encode Text to Base64

1

Enter your text

Type or paste the text you want to encode. Click Sample to try the tool with example text first.
2

Choose your options

Turn on URL-safe output for links and tokens, or line-by-line mode if you're encoding a list.
3

Click Encode

The tool converts your text to UTF-8 bytes and then to Base64 in an instant.
4

Copy and use it

Copy the Base64 string into your code, header or config file. Click Clear to encode something new.

Base64 Encode FAQs

Everything about turning text into Base64.

How do I encode a string to Base64?

Paste it into the box and click Encode. On macOS or Linux you can run echo -n 'Hello' | base64 (the -n stops a hidden line break from being encoded too). In Python, use base64.b64encode('Hello'.encode()). In JavaScript, btoa() works for plain English text, but use TextEncoder first for anything with special characters.

Why is my Base64 longer than the original text?

Base64 turns every 3 bytes into 4 characters, so the result is roughly 33% bigger. Non-English characters take 2 to 4 bytes each in UTF-8, so they grow even more. That's normal.

Why does my result end with = or ==?

Those are padding characters. They appear when the input length isn't a multiple of 3 bytes. Some systems, including JWTs, leave padding out, and URL-safe mode does that for you.

Is Base64 encoding secure?

No. Base64 hides nothing; it's a reversible format, not encryption. Treat Base64 text as if it were plain text. If you need real protection, encrypt the data first and then encode it if your system requires Base64.

Can I encode an image to Base64 here?

This box is built for text. For pictures, use Image to Base64. It turns PNG, JPG and other images into a Base64 string or data URI you can paste into HTML or CSS.

Why does the same text give a different result on another site?

Usually it's a hidden line break, a different character encoding, or standard versus URL-safe output. Check for trailing spaces or new lines, and make sure both tools use UTF-8.

What is Base64 encoding used for?

Email attachments, HTTP Basic Authentication headers (user:pass becomes dXNlcjpwYXNz), data URIs for small images, JSON Web Tokens, and storing binary data in text-only formats like JSON or XML.

How do I decode it back?

Paste the string into our Base64 Decode tool and you'll get your original text back, exactly as it was.

Encoded? Check that it decodes.

Paste your result into Base64 Decode to double-check it, or encode web addresses properly with URL Encode.

Base64 Decode

Raheel Jakhura

CEO / Co-Founder

Our goal is to provide online free tools so you don't have to install any software for basic usages. We are trying to add more tools and make these tools free forever.

cookies image
We care about your data and would love to use cookies to improve your experience.