Skip to content
briskly.tools
· briskly / dev tools / base64
· utf-8 · browser-only

Base64 encoder + decoder.

Text ↔ base64 with UTF-8 done right — handles emoji, accents, CJK, every Unicode character. Standard and URL-safe variants, file upload, live image preview for decoded PNG/JPG/GIF/WebP. Nothing uploads.

free · foreverutf-8 · url-safein-browser

no signup · no api key · nothing uploads

···
74 chars
116 chars

· runs in your browser via btoa / atob + TextEncoder · UTF-8 aware · nothing uploads

What base64 actually is

Base64 is a scheme for representing binary data using 64 text characters. Three input bytes become four output characters, each drawn from the alphabet A-Z a-z 0-9 + /. The output can contain =padding characters at the end so the length is always a multiple of four. That's the entire format — 65 characters of vocabulary (64 data + 1 padding) with strict rules for how bits map to them.

Three uses you'll encounter most: embedding images in HTML via src="data:image/png;base64,iVBOR...", authenticating HTTP requests via the Authorization: Basic ... header, and passing binary through JSON APIs that don't support binary natively.

Standard vs URL-safe

Standard base64 uses +, /, and = — three characters with special meaning in URLs. So if you need to put base64 in a URL path, query string, or JWT, use the URL-safe variant which swaps + for -, / for _, and typically drops the = padding. Both encode and decode the exact same bytes; the difference is purely cosmetic / URL-safety.

Why UTF-8 handling matters

JavaScript's built-in btoa() function operates on binary strings — it assumes every character is exactly one byte. The moment you hand it UTF-8 content with multi-byte characters (emoji, most non-English scripts), it either throws an error or silently mangles them. This tool wraps btoa() with TextEncoder so the UTF-8 bytes are generated explicitly before encoding. Try pasting "café" or "🎉" above — you get bytes that decode back cleanly in any UTF-8-aware decoder.

Base64 in other languages

// JavaScript (browser)
btoa(unescape(encodeURIComponent(str)))        // encode UTF-8
decodeURIComponent(escape(atob(base64)))       // decode UTF-8

// Node.js
Buffer.from(str, "utf8").toString("base64")
Buffer.from(base64, "base64").toString("utf8")

// Python
import base64
base64.b64encode(s.encode("utf-8")).decode("ascii")
base64.b64decode(b).decode("utf-8")

// Bash / Linux
echo -n "hello" | base64
echo "aGVsbG8=" | base64 -d

// PowerShell
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("hello"))
[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("aGVsbG8="))

FAQ

What is base64?

Base64 is a text encoding that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). Each 3 bytes of binary input become 4 base64 characters. It's used anywhere binary data needs to live inside a text-based medium: email attachments (MIME), data URLs, JSON payloads, basic authentication headers, JWT signatures. It's not encryption — it's easily reversible, and anyone can decode base64 without a key.

Why is my base64 output different from another tool?

Three likely reasons. One, UTF-8 handling: some tools only work with ASCII and mangle multi-byte characters (emoji, accents, CJK) in the input before encoding. This tool handles UTF-8 correctly. Two, variant: standard base64 uses + and /, URL-safe uses - and _ and often drops padding. Check the variant toggle. Three, trailing newlines or whitespace — a hidden newline at the end of your input changes the output.

What's the difference between standard and URL-safe base64?

Standard uses +, /, and = padding. URL-safe replaces + with -, / with _, and typically omits the = padding. This lets you put base64 strings into URLs without encoding them (the / character has special meaning in URLs, and + means space when form-encoded). JWTs use URL-safe base64. Most REST APIs use standard base64 for bodies. Toggle the variant above based on where the output will go.

Can base64 encode a file?

Yes — click 'upload file' and pick any file. The tool reads the file as binary, encodes it to base64, and drops the result in the input panel. Base64 file encoding is used in data URLs (embed an image directly in HTML/CSS), email attachments (MIME-encoded), and some JSON APIs that accept files inline. Note: base64-encoded files are about 33% larger than the original, so it's efficient for small files (images, fonts, tiny binaries) and wasteful for large ones.

Is base64 secure? Can I use it to hide data?

No. Base64 is encoding, not encryption. Anyone can decode base64 in about one second (including this tool). If someone finds a base64 string in your code, database, or URL, they can read it. Use base64 for transport (fitting binary into text), not for secrets. For secrets: use actual encryption (AES, NaCl/libsodium) plus proper key management, or just don't put secrets where they can be read.

Why does decoded base64 sometimes look like gibberish?

Because the original data was binary, not text. Base64 can encode any bytes — images, PDFs, encrypted data, compiled code. Decoding base64 of binary content gives you the raw bytes, which look like garbage in a text field. If the input is an image, this tool shows a preview automatically. For other binary formats (PDF, ZIP), download the decoded output and open it in the appropriate app.

Is anything I paste uploaded anywhere?

No. Encoding and decoding use the browser's built-in btoa() / atob() APIs plus the TextEncoder/TextDecoder APIs for UTF-8. No network requests, no server, no log. Your input and preferences are persisted in localStorage for convenience — that data stays in your browser.

What's the maximum input size?

Limited by your browser's available memory — typically 100MB+ of text works fine in modern browsers. For truly large files (gigabytes), a streaming encoder on the command line is better: on Unix, `base64 < file.bin > file.b64`. Windows PowerShell: `[Convert]::ToBase64String([IO.File]::ReadAllBytes('file.bin'))`.

How do I base64 encode in JavaScript / Python / other languages?

JavaScript (modern browsers): btoa(str) for ASCII; for UTF-8, wrap with new TextEncoder().encode() first as we do here. Node.js: Buffer.from(str, 'utf8').toString('base64'). Python: base64.b64encode(s.encode('utf-8')). Most languages have it built in. This tool exists because doing it in your browser is faster than opening a terminal for a one-off conversion.

Working with data? You might also want the JSON ↔ CSV converter, the regex tester, or the UUID generator. See the full dev hub for everything.