Base64 Encoder & Decoder
Encode UTF-8 text to Base64 online or decode Base64 back to UTF-8 and plain text. Runs in your browser with no upload.
Reviewed by Aygul Dovletova · Last reviewed
How to Use the Base64 Encoder Decoder Online
- Choose a mode - click "Encode" to convert plain text into a Base64 string, or "Decode" to reverse a Base64 string back to human-readable text.
- Paste or type your input into the text area. The tool accepts any UTF-8 text, including emoji, accented characters, and non-Latin scripts.
- Press the action button to run the conversion. The result appears immediately in the output field.
- Copy the result with the one-click copy button, or hit Swap to move the output back into the input and reverse the direction.
About Base64 Encoding
Base64 is a binary-to-text encoding that represents any stream of bytes using only 64 printable ASCII characters: A-Z, a-z, 0-9, plus the symbols + and /, with = used as padding. Every three bytes of input are split into four 6-bit groups, and each group is mapped to one character from the alphabet. This means Base64 output is always about 33% larger than the original data.
The scheme was formalized in RFC 2045 as part of MIME (Multipurpose Internet Mail Extensions) so that binary attachments could survive passage through mail servers that only handle 7-bit ASCII. Today it powers data: URIs in CSS and HTML, JSON Web Tokens, HTTP Basic authentication headers, and many API payloads where raw bytes need to travel inside a text-only field.
Base64 is deliberately reversible and carries no secret: anyone holding a Base64 string can decode it instantly. It is therefore a transport encoding rather than a security primitive. If you need confidentiality, encrypt the data first with AES-GCM or a similar authenticated cipher and then Base64-encode the ciphertext for safe transmission through a text-only channel.
Base64 to UTF-8 and UTF-8 to Base64
The hardest thing about Base64 in the browser is not the encoding itself - it is making sure text stays correct after a round-trip. Browser built-ins btoa and atob only accept Latin-1 code points, so a naive encode of "naïve" or "こんにちは" throws InvalidCharacterError. This online Base64 encoder decoder solves that by running input through TextEncoder to turn the string into UTF-8 bytes before btoa, and running the output of atob through TextDecoder on the way back. That means Base64 to UTF-8 and UTF-8 to Base64 both work end-to-end on any Unicode input: emoji, Cyrillic, Arabic, Chinese, Japanese, combining accents, right-to-left marks, zero-width joiners - all of it survives the conversion unchanged.
Why Use an Online Base64 Encoder Decoder
- Debugging a
data:URL you pulled out of HTML, CSS, or a browser "Copy image as data URL" right-click - paste the payload and see what it decodes to. - Inspecting the payload of a JSON Web Token: JWT splits its three segments with "." and Base64url-encodes each, and this encoder decoder (with a dash-to-plus swap) reads them.
- Preparing an HTTP Basic authentication header: Base64 encode the literal string
user:passwordand drop the result after "Basic " in the Authorization header. - Passing binary payloads inside JSON fields that only accept strings - convert base 64 online is how a PNG thumbnail or a small certificate rides inside an API request.
- Embedding a small SVG icon or web font directly in HTML/CSS with a data URI to save an HTTP request on the critical path.
- Reading a MIME email attachment that was encoded with "Content-Transfer-Encoding: base64" and decoding it back to bytes.
Examples
- Text
HellobecomesSGVsbG8=. The trailing=is padding because the input length is not a multiple of three bytes. - Text
Man(three bytes, no padding needed) becomesTWFu. - Emoji
👋(four UTF-8 bytes) becomes8J+Riw==, demonstrating that multi-byte characters encode correctly.
Base64 vs URL Encoding
Base64 and URL (percent) encoding solve different problems and are not interchangeable. Base64 takes arbitrary bytes and produces a 7-bit ASCII string using a 64-character alphabet, with a roughly 33 percent size overhead. URL encoding takes a string and replaces only the characters that are unsafe inside a URL component (space, &, ?, #, non-ASCII bytes) with %XX sequences. URL encoding leaves safe ASCII alone, so the overhead for plain English text is near zero. The shortcut: use Base64 when you need to put binary data inside a text-only field (JSON body, HTTP header, data URL); use URL encoding when you need to put a string into a URL query parameter, path segment, or form body. The URL encoder and decoder handles the latter case. Note also Base64url (RFC 4648 section 5), a URL-safe Base64 variant that swaps + and / for - and _ and drops trailing padding - it is what JWT and many OAuth flows use.
Base64 to Text and Text to Base64 in the Same Tool
Most users land here looking for "base64 to text" or "text to base64" - both are the same encode/decode pair. Pick Encode to convert text to a Base64 string, or Decode to turn a Base64 string back to readable text. The output mirrors what command-line base64 on macOS or Linux produces, so paste the result of echo -n "Hello" | base64 here and you will get Hello back. For the inverse direction, the result matches echo "SGVsbG8=" | base64 -d. Need to encrypt the text first so the Base64 output is meaningless without a key? Run it through the AES encrypt and decrypt tool, then Base64-encode the ciphertext here. To inspect a Base64-encoded JWT segment, decode it with the JWT decoder, which handles the URL-safe Base64url variant automatically.
Convertitore Base64 online
Questo convertitore Base64 online esegue la codifica e la decodifica direttamente nel tuo browser: incolla il testo UTF-8 per ottenere una stringa Base64, oppure incolla una stringa Base64 per riottenere il testo originale senza perdere accenti, emoji o caratteri non latini. Non serve registrazione, nessun file viene caricato su un server e il risultato appare immediatamente. Ideale per preparare un header HTTP Basic, ispezionare un data URL, leggere un payload JWT o inserire un piccolo asset in HTML o CSS. Supporta Unicode completo grazie a TextEncoder e TextDecoder.
Convertisseur Base 64 en ligne
Ce convertisseur Base 64 en ligne encode vos chaînes UTF-8 en Base64 et décode en sens inverse, entièrement dans votre navigateur. Collez le texte à encoder ou la chaîne à décoder, le résultat s'affiche instantanément et rien n'est envoyé à un serveur. L'outil gère parfaitement les accents, les emoji, l'arabe, le chinois et tout autre caractère Unicode, sans l'erreur habituelle d'InvalidCharacterError. Pratique pour inspecter un JWT, générer une en-tête HTTP Basic, lire un message MIME ou intégrer un actif inline via un data URL.
Convertir Base 64 online
Convertir Base 64 online nunca fue tan simple: pega tu texto UTF-8 para obtener una cadena Base64 lista para un payload JSON, un encabezado HTTP Basic o un data URL, o pega una cadena Base64 para recuperar el texto original. Todo el proceso sucede en tu navegador, sin subir nada a ningún servidor y sin registro. El codificador y descodificador Base64 admite Unicode completo - emojis, tildes, cirílico, chino y árabe - gracias al uso interno de TextEncoder y TextDecoder, así que no aparecen los errores típicos de btoa.
Frequently Asked Questions
What is Base64 and why does it exist?
Base64 is a binary-to-text encoding that represents eight-bit bytes using a 64-character ASCII alphabet. It was standardized in RFC 2045 as part of MIME so that binary email attachments could survive transmission through servers that handle only seven-bit text. Today it is used wherever arbitrary bytes must travel inside a text-only channel, including JSON APIs, HTTP headers, data URIs, JWT tokens, and configuration files.
Is Base64 a form of encryption?
No. Base64 is encoding, not encryption. The transformation is public and completely reversible with no key required, so anyone who sees a Base64 string can decode it instantly. Never use Base64 to hide passwords, API keys, or personal data. If you need confidentiality, use real encryption such as AES-GCM. Base64 is only useful for making binary data safe to transport as text.
Why is Base64 output roughly 33 percent larger than the input?
Base64 packs every three input bytes (24 bits) into four output characters (each carrying six bits of information). That four-to-three ratio is a 33.3 percent size increase. When the input length is not a multiple of three, the encoder adds one or two <code>=</code> padding characters so the output length stays a multiple of four. This overhead is the cost of staying inside a 7-bit ASCII channel.
Does this tool correctly handle Unicode and emoji?
Yes. Browser functions <code>btoa</code> and <code>atob</code> only accept Latin-1 characters and throw <code>InvalidCharacterError</code> on things like emoji or Cyrillic text. This tool pipes your text through <code>TextEncoder</code> to turn it into UTF-8 bytes first, then Base64-encodes those bytes. Decoding reverses the process with <code>TextDecoder</code>, so characters such as 🚀 or Chinese text round-trip without corruption.
Is my input sent to a server?
No. Every conversion runs entirely in your browser using JavaScript and the Web APIs <code>TextEncoder</code>, <code>TextDecoder</code>, <code>btoa</code>, and <code>atob</code>. Nothing is transmitted, uploaded, logged, or stored. You can even disconnect from the internet after the page loads and the tool will keep working. This makes it safe to encode or decode sensitive strings without worrying about third-party exposure.
What is the difference between standard Base64 and Base64url?
Standard Base64 uses <code>+</code> and <code>/</code> as its 63rd and 64th characters, which are unsafe inside URLs and filenames because they have special meaning. Base64url (RFC 4648 section 5) substitutes <code>-</code> and <code>_</code> and usually omits trailing <code>=</code> padding. It is the format required by JWT and many OAuth flows. This tool produces standard Base64; convert the two variants by replacing characters one-for-one when needed.
Are there limits on input size?
There is no hard cap, but everything runs in browser memory on the main thread. Strings up to a few megabytes encode in milliseconds. Inputs in the tens of megabytes may briefly freeze the tab, and anything near a gigabyte will likely crash it. For very large files, prefer a command-line tool such as <code>base64</code> on macOS or Linux, or <code>certutil -encode</code> on Windows, which stream data from disk.
What does the trailing equals sign mean in the output?
Base64 outputs four characters for every three input bytes. When the input length is not a multiple of three, padding aligns the output to a multiple of four characters. One leftover byte produces two output characters plus <code>==</code>, and two leftover bytes produce three characters plus a single <code>=</code>. Padding is purely structural and contains no data; some decoders accept strings without padding, but including it maximizes compatibility.
How do I convert Base64 to text?
Switch the tool to Decode mode and paste your Base64 string into the input field. The decoded text appears in the output area immediately, fully UTF-8-aware so accented characters, emoji and non-Latin scripts come back exactly as they were before encoding. If your Base64 string came from a JWT or OAuth flow it is probably the URL-safe variant (Base64url) - replace any <code>-</code> with <code>+</code> and <code>_</code> with <code>/</code> before decoding, and add <code>=</code> padding until the length is a multiple of four. The standalone <a href="/tools/jwt-decoder/">JWT decoder</a> handles those swaps automatically for token payloads.
Is "base64 to text" the same as "base64 decode"?
Yes. "Base64 to text", "base64 string converter" and "decode base64 string" all map to the same operation: taking a Base64-encoded string and producing the original UTF-8 text it represents. The result depends on what was originally encoded - if the source was readable text you get readable text back; if the source was raw binary bytes (an image, an encrypted blob, a public key) the decoded "text" will look like garbage and you should use a binary-aware tool instead. To turn a Base64 image back into a viewable picture, use the <a href="/tools/base64-to-image/">Base64 to image converter</a>.
Is it safe to encode passwords in Base64?
No. Base64 is not encryption - it is a public, fully reversible transformation. Storing a password as Base64 is equivalent to storing it in plain text from a security standpoint, because anyone who sees the encoded string can decode it instantly with this tool or one line of code. For HTTP Basic auth the standard does require Base64-encoded credentials, but the protection there comes from sending the request over HTTPS, not from the encoding itself. To actually protect a password at rest, hash it with a slow KDF such as bcrypt, scrypt or Argon2, never Base64 it.
How does Base64 differ from URL encoding?
Base64 encodes arbitrary bytes into a 7-bit ASCII string using a 64-character alphabet, adding about 33 percent overhead. URL (percent) encoding only replaces characters unsafe inside a URL component (space, &, ?, #, non-ASCII) with %XX sequences and leaves the rest alone, so plain English text has near-zero overhead. Use Base64 when you need binary data inside a text-only field (JSON, HTTP header, data URL); use URL encoding for query strings, path segments and form bodies. The two are not interchangeable.
Learn more
More Developer Tools
Bulk URL Encode / Decode
Encode or decode many URLs at once. Paste a newline-separated list and the tool processes each line in parallel, preserving order and blank lines.
Open toolCode Screenshot
Create beautiful code snippet images with customizable themes.
Open toolColor Converter
Convert colors between HEX, RGB, HSL and CMYK formats.
Open toolCron Expression Parser
Parse cron expressions into human-readable schedules with next run times.
Open toolCSS Formatter / Minifier
Format, beautify and minify CSS code.
Open toolCSV to JSON Converter
Convert CSV data to JSON array format.
Open tool