Skip to content
ToolForge
Developer Tools

Base64 Encoder and Decoder

Free Base64 encoder and decoder for text and files. Encode or decode UTF-8 safely, convert text to a data URI, and encode binary files without breaking on non-Latin characters.

Free, no sign-upRuns in your browserNothing uploaded

Encoded as UTF-8

Multi-byte characters are encoded correctly, so accented letters, CJK text and emoji survive the round trip.

Output, read only.

Data URI: data:text/plain;base64,R3LDvMOfZSBhdXMgTcO8bmNoZW4g4oCUIGNhZsOpIOKYlSDml6XmnKzoqp4=

input chars
30
output chars
60
encoding overhead
+36%

Base64 is an encoding, not encryption. Anyone with the string can decode it in one step, so never use it to protect a password, token or API key.

Base64 turns binary data into text using a 64-character alphabet, so it can travel through places built for text: email bodies, JSON fields, URLs and query parameters. This tool encodes and decodes in both directions, for plain text and for whole binary files.

The detail that breaks most online Base64 tools is UTF-8. JavaScript's built-in btoa and atob operate on Latin-1, one character per byte, so any accented letter, emoji or non-Latin script throws an error or comes back as mojibake. This tool encodes text as UTF-8 first and decodes it back to UTF-8, so 'café', 'Grüße' and Japanese text all round-trip correctly.

For files, it produces a data URI you can paste straight into CSS or an HTML attribute, and it will also decode a data URI back into a downloadable file. Base64 is an encoding, not encryption: anyone with the string can decode it, so never use it to hide a secret or an API key.

Base64 Encoder & Decoder features

Correct UTF-8 handling
Text is encoded and decoded as UTF-8, so accented characters, CJK scripts and emoji survive the round trip instead of becoming mojibake.
File to data URI
Turn any file into a complete data URI for use in a CSS background, an image src or a JSON payload.
URL-safe output
Switch to base64url with - and _ instead of + and /, which is what JWT, cookies and URL path segments require.
Line wrapping control
Insert a newline every 64 or 76 characters, or keep everything on one line, to match MIME and certificate formats.
Whitespace tolerant decoding
Ignores line breaks and spaces when decoding, so a wrapped string from an email or PEM file works as-is.
Strict validation with clear errors
Reports the exact offset of an invalid character and distinguishes bad padding from a truncated input.
Everything stays local
Conversion happens in your browser. There is no upload endpoint and nothing is logged.

How to use the Base64 Encoder & Decoder

  1. Choose a direction

    Select Text to Base64 or Base64 to text. For files, switch to the file tab and drop in anything - images, PDFs, archives.

  2. Paste or drop your input

    Text goes straight into the editor and converts as you type. Files are read locally in the browser; nothing is uploaded.

  3. Check the output

    Output size, the 33% encoding overhead and a checksum-style character count are shown. Padding and line wrapping can be toggled for the formats that need it.

  4. Copy or download

    Copy the encoded string, or use the data URI button to get a ready-to-paste background-image value. For files you can download the decoded result directly.

Frequently asked questions

Is Base64 encryption?

No. It is an encoding that anyone can reverse in one step. It provides no confidentiality whatsoever. Never use Base64 to protect a password, an API key or a token - use proper hashing or encryption for that.

Why do emoji and accented characters break other Base64 tools?

Because the built-in btoa and atob functions treat their input as Latin-1, one JavaScript character per byte. Any character outside that range either throws InvalidCharacterError or decodes to garbage. This tool encodes to UTF-8 bytes first and decodes them back, which is what those tools were meant to do.

Why does my Base64 output end in one or two equals signs?

Those are padding. Base64 encodes 3 bytes as 4 characters, so an input that is not a multiple of 3 needs = padding. Standard decoders require it; some lenient ones do not. JWT uses base64url, which drops the padding entirely.

When should I use Base64?

For putting binary data into a text-only field, embedding a small image directly in CSS or HTML, encoding an HTTP Basic Authorization header, and inside JWTs. Do not use it to serve large files - it adds about 33% before compression and browsers cannot cache or range-request it the way they can a real file.

What is base64url?

A URL-safe variant that substitutes - for + and _ for / and removes = padding, so the result can go in a query parameter, a URL path or a cookie without escaping. Use the URL-safe toggle for JWT payloads and anything bound for a URL.

Does a Base64 data URI work for images?

Yes, and it is convenient for small images used once, such as icons and spacers. Be careful with anything large: a data URI cannot be cached separately from its stylesheet or HTML, which usually makes repeat visits slower than a real image file.

Every tool, in one place

ToolForge has base64 encoder & decoder plus a growing set of image, colour and developer tools. All of them run locally in your browser, free and without an account.

Browse all tools