Base64 String Encoder and Decoder
Encode a text string as Base64 or decode a Base64 string back to readable UTF-8. Standard and URL-safe output are handled locally in your browser.
Written and checked by TheToolNet Editorial Team · Last reviewed: October 11, 2026 · Editorial method
Encode or decode a Base64 string
What Base64 encoding does
Base64 represents bytes with a 64-character alphabet so binary data can travel through text-oriented systems. Standard Base64 uses letters, digits, +, /, and optional = padding. The URL-safe variant replaces the two punctuation characters with - and _. See RFC 4648.
Python Base64 encode example
import base64
encoded = base64.b64encode("Hello".encode("utf-8")).decode("ascii")
decoded = base64.b64decode(encoded).decode("utf-8")JavaScript Base64 string example
const bytes = new TextEncoder().encode(text);
// Convert bytes to a binary string before calling btoa().Browser btoa() works on byte-valued strings, not arbitrary Unicode text. This tool uses TextEncoder and TextDecoder so emoji and non-Latin scripts round-trip correctly.
Frequently asked questions
What is Base64 encoding used for?
Common uses include data URLs, email attachments, API payloads, tokens, and moving binary bytes through text-only fields.
Can I encode an image?
Yes. Use the separate image Base64 converter so the MIME type and preview can be checked.