Base64 Encode and Decode
Paste your text, choose direction and format, copy the result: this tool converts text to Base64 or Base64url and back – accented letters and emoji handled correctly as UTF-8 – and does URL encoding with percent signs in all three common variants. Invalid input is reported with its position.
How it is calculated
Base64 represents arbitrary bytes using just 64 printable characters (A–Z, a–z, 0–9, + and /). Every 3 bytes become 4 characters; if bytes are left over at the end, one or two equals signs fill the gap (padding). The result is about a third longer than the original. This lets binary data travel through channels that only accept text – email attachments, data URLs (data:image/png;base64,…), HTTP Basic Auth or JSON.
Base64 is not encryption. Anyone can turn it back into the original without a key. Never rely on Base64 to protect credentials.
Base64 vs. Base64url
The plus sign and the slash have special meanings in URLs and file names. Base64url (RFC 4648 § 5) therefore replaces them with the minus sign and the underscore and usually drops the padding – JSON Web Tokens (JWT) are encoded this way. Example: the bytes FB FF become +/8= in Base64 and -_8 in Base64url.
Why UTF-8 matters
Base64 encodes bytes, not letters. The tool therefore converts your text to UTF-8 first: “ü” becomes two bytes, an emoji four. The browser’s built-in btoa() can’t do this and throws an error on non-Latin-1 characters. If the decoded bytes aren’t valid UTF-8 text, the tool shows them as hexadecimal values.
URL encoding: three variants
- Part of a URL (
encodeURIComponent): encodes everything except A–Z, a–z, 0–9 and- _ . ! ~ * ' ( )– including/ ? & = #. Right for single values, such as a search term in?q=…. - Full URL (
encodeURI): keeps characters with a special meaning (: / ? # & = +…) and only encodes spaces, accented letters and the like. For a complete link that should keep working. - Form data (
application/x-www-form-urlencoded): how HTML forms submit their data. Spaces become+, and! ' ( ) ~are encoded as well. When decoding,+turns back into a space.
Every character outside the allowed set is written as % followed by two hex digits per UTF-8 byte (RFC 3986 § 2.1): space = %20, é = %C3%A9.
All conversions run in your browser. Your input is not sent, not stored and not written into the address bar.
Frequently asked questions
How do I decode Base64?
Choose “Decode” and the “Base64” format, then paste the code – the plain text appears straight away. If the code contains - and _, it is Base64url; choose that format instead.
Is Base64 encryption?
No. Base64 is just another way of writing the same data and can be reversed without a key. To protect data you need real encryption, and for passwords a password hash.
Why does Base64 often end with = or ==?
Base64 works in groups of 3 bytes. If 1 or 2 bytes are left at the end, the output is padded with == or = so that its length is a multiple of 4. Base64url usually omits this padding.
What is the difference between encodeURI and encodeURIComponent?
encodeURI is meant for complete addresses and leaves / ? & = # alone. encodeURIComponent encodes those too and is the right choice for individual parameter values – otherwise an & inside the value would break the URL apart.
Why is a space sometimes %20 and sometimes +?
In paths and under RFC 3986 a space is written as %20. HTML forms (application/x-www-form-urlencoded) write it as +. When decoding you need to know which variant you have – a real plus sign is written as %2B there.
How much bigger does a file get in Base64?
About 4/3 of the original size: 3 bytes become 4 characters. A 300 KB image becomes roughly 400 KB in Base64, a little more with MIME line breaks.
Sources and legal basis
- RFC 4648: RFC 4648 – The Base16, Base32, and Base64 Data Encodings (§ 4 Base64, § 5 Base64url, § 3.2 Padding)
- RFC 3986: RFC 3986 – Uniform Resource Identifier (URI): Generic Syntax (§ 2.1 Percent-Encoding, § 2.2 Reserved Characters)
- WHATWG URL Standard – application/x-www-form-urlencoded
- MDN Web Docs – encodeURIComponent()
- MDN Web Docs – encodeURI()
- MDN Web Docs – Base64 (Unicode problem, TextEncoder)
As of:
Related tools
- Hash Generator: SHA-256, SHA-512, SHA-1, MD5Calculate SHA-256, SHA-384, SHA-512, SHA-1 and MD5 hashes of text or files and verify checksums – locally in your browser, no upload, free.
- Regex TesterTest JavaScript regular expressions live: matches highlighted, capture groups in a table, every part of the pattern explained. Free, nothing uploaded.
- JSON formatter, validator and minifierValidate JSON against RFC 8259 with the exact line, column and a plain-English explanation. Beautify or minify, sort keys, copy. Runs locally in your browser.
- UUID generator: create and validate UUID v4 and v7Generate UUIDs online: version 4 (random) or version 7 (time-ordered), up to 1,000 at once. Validate a UUID and decode its version, variant and timestamp.
- Password GeneratorGenerate secure random passwords and memorable passphrases with entropy shown in bits — calculated right in your browser, nothing sent or stored.
- Aspect Ratio CalculatorCalculate the aspect ratio from width and height (1920 × 1080 = 16:9), find the missing side, decimal value, nearest standard ratio and CSS aspect-ratio.