Base64 Encoder & Decoder - Safe UTF-8 Conversion
Encode text to Base64 or decode Base64 back to plain text with UTF-8 and URL-safe options.
About this tool
Base64 is a text encoding that represents arbitrary binary data as a plain ASCII string using 64 characters: A–Z, a–z, 0–9, "+" and "/". It is used everywhere a system can only handle text, for example when embedding an image in CSS, sending an email attachment, or storing binary data inside JSON. This tool encodes and decodes base64 (including URL-safe base64url) entirely in your browser. Nothing ever leaves the page.
How to use it
- Choose "Encode" to convert text into base64, or "Decode" to go the other way.
- Type or paste your text into the input field.
- Check "URL-safe" if you need the base64url variant (used in JWTs and URL parameters).
- The result updates automatically. Press "Copy" to put it on your clipboard.
Examples
Hello, world!SGVsbG8sIHdvcmxkIQ==Kaffe ☕ tid!S2FmZmUg4piVIHRpZCE=subjects?/&filterc3ViamVjdHM_Ly1maWx0ZXICommon use cases
- Embedding small images (SVG, icons) directly in CSS or HTML as data URLs.
- Placing binary data inside JSON or XML structures.
- Encoding username/password for HTTP Basic Auth headers.
- Sending attachments in email (MIME) and other text-based protocols.
- Reading or decoding the payload of JSON Web Tokens (JWT).
- Storing small binary blobs in cookies or localStorage.
Frequently asked questions
- Is base64 a form of encryption?
- No. Base64 is just another way to represent the same bytes, anyone can decode it instantly. Never use base64 to hide passwords or sensitive data.
- Why is the encoded string longer than the original?
- Base64 packs 3 bytes into 4 characters, so the output is always about 33 % larger than the input. That is the cost of transmitting binary data safely through text channels.
- What is the difference between base64 and base64url?
- base64url is a variant where "+" and "/" are replaced with "-" and "_", and the "=" padding is stripped. That makes it safe to use in URLs and filenames. JWTs are always base64url encoded.
- Can I encode files with this tool?
- This tool is for text. For files, use our dedicated "File to base64" tool that handles binary data directly from disk without uploading anything.
- Is my data sent to a server?
- No. All encoding and decoding happens in your browser with `btoa` and `atob`. No requests leave the page.
Technical background
Base64 is defined in RFC 4648. The standard alphabet uses A–Z, a–z, 0–9, "+" and "/" with "=" as padding. The encoding processes three bytes (24 bits) at a time, splitting them into four 6-bit values, each mapped to one character. Base64url (same RFC, §5) is identical but replaces "+"→"-" and "/"→"_" so the string is safe to use in URLs and filenames, and typically drops the padding. Our tool accepts both variants when decoding, with or without padding.