Base64 Encoder & Decoder (UTF-8 & URL-Safe) — Free Online Tool
Encode and decode UTF-8 text, JWT-ready URL-safe Base64, and files to Data URIs instantly in your browser with live validation and zero server uploads.
Base64 Encoder
How to Use This Tool
- 01 Select Encode to turn plain UTF-8 text into Base64, or Decode to convert a Base64 string (or Data URI) back into readable text.
- 02 Enable "URL-safe (-_, no padding)" when generating values for URLs, query parameters, filenames, or JWT payloads (RFC 4648 §5).
- 03 Paste your text or Base64 payload into the left editor—the output updates immediately as you type, along with live validation and byte-size stats.
- 04 Click Swap anytime to flip the output into the input and switch between Encode and Decode modes.
- 05 To convert an image, SVG, font, or small document into an inline Data URI, use the File to Base64 / Data URI panel below and click Copy Data URI or Copy Base64.
- 06 Click Copy Output to copy your encoded or decoded string to the clipboard in one click.
How It Works
Practical Examples
Encoding UTF-8 Text with Accents and Emojis
Olá mundo! 🚀
T2zDoSBtdW5kbyEg8J+agA==
Unlike plain btoa(), which throws an InvalidCharacterError on "á" or "🚀", UTF-8 byte encoding cleanly preserves every Unicode character.
URL-Safe Base64 for Tokens & Query Strings
subjects?_d=1&x=>> (URL-safe enabled)
c3ViamVjdHM_X2Q9MSZ4PT4-
Replacing + and / with - and _ and stripping = padding guarantees the encoded token never breaks URL routing or query parsers.
Inlining an SVG Icon as a Data URI
File: icon.svg (<svg/>)
data:image/svg+xml;base64,PHN2Zy8+
Small icons or placeholders can be embedded directly inside HTML img src or CSS background-image rules to eliminate extra HTTP requests.
Tips & Best Practices
- Remember that Base64 is an encoding, NOT encryption—anyone can decode Base64 instantly, so never rely on it to hide secrets.
- Base64 increases payload size by roughly 33% (4 output characters per 3 input bytes); only inline small assets as Data URIs.
- When decoding a JWT payload segment, you can paste it directly into Decode mode—our decoder automatically handles URL-safe characters and missing = padding.
- You can paste a full Data URI (data:text/plain;base64,...) directly into Decode mode; the prefix is stripped automatically.
- All encoding and decoding happen offline in browser memory, making it safe for private headers and internal tokens.
Frequently Asked Questions
Is Base64 a form of encryption?
No. Base64 is a reversible text encoding designed to transport binary data safely over text-only channels. It provides zero confidentiality or security on its own.
Does this tool send my text or uploaded files to a server?
No. Both text encoding/decoding and file-to-Data-URI conversion run 100% locally inside your browser using JavaScript Web APIs.
What is URL-safe Base64 (Base64URL)?
URL-safe Base64 (defined in RFC 4648 Section 5) swaps "+" for "-" and "/" for "_" and removes trailing "=" padding so the string can safely appear in URLs, cookies, and JWT tokens without escaping.
Why does Base64 make my data about 33% larger?
Base64 maps every 3 binary bytes (24 bits) onto 4 ASCII characters (6 bits each), which introduces a fixed 4/3 (~33.3%) size overhead.
Can this tool decode Base64 with Portuguese, Spanish, or emoji characters?
Yes. It encodes and decodes via standard UTF-8 byte arrays (TextEncoder/TextDecoder), so accented characters, symbols, and emojis round-trip accurately.
Related Tools
CSV ↔ JSON
Convert CSV to JSON and JSON to CSV bidirectionally in your browser with full RFC-4180 quote handling, custom delimiters, header toggles, and instant download.
JSON Formatter
Beautify, validate, sort keys, and minify JSON payloads instantly in your browser with line-by-line error diagnostics and one-click download.
JWT Decoder
Decode JWT headers and payloads; inspect signature segments and expiry dates instantly. Review claims locally in your browser with clear warnings.
Regex Tester
Test JavaScript regular expressions with live match highlighting, capture groups, flags and replacement preview. Runs locally in your browser.