Embed this tool on your site
About this tool
Base64 Encoder/Decoder is a browser-only tool for converting text to and from Base64. Paste any string, such as a JSON payload, an SSH public key or a username:password pair, and click Encode to Base64; paste a Base64 string and click Decode to text to get the original back. Text is converted to UTF-8 bytes before encoding, so emoji, accented letters and CJK characters round-trip correctly. Decoding uses the standard alphabet (A-Z, a-z, 0-9, + and /): spaces and line breaks are ignored and missing = padding is tolerated, but URL-safe strings that contain - or _ must be converted to + and / first. If the input is not valid Base64, or does not decode to UTF-8 text, the tool shows an Invalid Base64 input message. Use result as input moves the output back into the source box for chained operations. Everything runs locally with the browser's btoa and atob functions — nothing leaves your machine.
Why use it
Full UTF-8 and Unicode Support: Plain btoa throws on characters outside Latin-1. This tool converts the text to UTF-8 bytes first, so emoji, accented characters, CJK glyphs and Arabic text encode and decode correctly.
Chained Conversions: Use result as input moves the output back into the source box, so you can decode a value you just encoded, or unwrap a string that was Base64-encoded twice, without copy-pasting.
Zero Server Transmission: Credentials, private keys, tokens, and personal data never leave the browser tab. This makes the tool safe to use with secrets that must not touch external servers, unlike online tools that proxy through a backend or log requests.
Clear Invalid-Input Message: When a string cannot be decoded — because it has illegal characters, is truncated, or decodes to bytes that are not UTF-8 text — the tool shows Invalid Base64 input instead of returning garbled output.
Tolerates Wrapped Base64: Decoding ignores spaces and line breaks, so PEM blocks and MIME bodies wrapped at 64 or 76 characters can be pasted as they are.
How to use
- Paste or type text to encode, or a Base64 string to decode, into the Text or Base64 box.
- Click 'Encode to Base64' to convert the text (as UTF-8) into standard Base64 with = padding.
- Click 'Decode to text' to turn a Base64 string back into readable text.
- If decoding fails, an 'Invalid Base64 input' message appears; check for URL-safe characters (- and _), missing characters or binary data.
- Click 'Copy result' to copy the output, or 'Use result as input' to move it into the source box.
- Click 'Clear' to empty the input and the result.
When it helps
- Constructing an HTTP Basic Authentication header by encoding username:password to Base64.
- Decoding a JWT header or payload segment (the first two dot-separated parts are Base64URL-encoded).
- Embedding a small PNG or SVG as a data URI in a CSS file or HTML attribute.
- Inspecting a MIME email attachment encoded as Base64 in a raw .eml file.
- Encoding an API key or secret before storing it in an environment variable that must be ASCII-safe.
- Verifying that a Base64 string returned by a third-party service decodes to the expected plaintext or JSON.
Examples
01Encode an HTTP Basic Auth credential
Inputalice:s3cr3tP@ssword
Expected resultYWxpY2U6czNjcjN0UEBzc3dvcmQ=
02Decode a Base64 API response fragment
InputeyJzdGF0dXMiOiJvayIsInVzZXIiOiJhbGljZSJ9
Expected result{"status":"ok","user":"alice"}
03Encode a Unicode string with emoji
Expected resultSGVsbG8g8J+MjQ==
Tips
- To read a JWT payload here, take the second dot-separated segment, replace - with + and _ with /, then click Decode to text — or use the JWT Decoder, which does this for you.
- When building a Basic Auth header, encode the string as username:password (colon-separated, no spaces), then prepend 'Basic ' to the result.
- A Base64-encoded string is always approximately 33% longer than the original input — factor this into cookie or header size budgets.
- PEM certificate files (-----BEGIN CERTIFICATE-----) contain standard Base64 with newlines every 76 characters. Paste the block between the header and footer lines for clean decoding.
- Encoded output always uses the standard alphabet with = padding; for a URL-safe value, replace + with -, / with _ and drop the trailing = yourself.
Frequently Asked Questions
Is Base64 a form of encryption?⌄
No. Base64 is purely an encoding scheme — it represents binary data using 64 printable ASCII characters. It provides no confidentiality; anyone who sees the encoded string can decode it in seconds. Never rely on Base64 alone to protect sensitive data.
What is the difference between standard Base64 and URL-safe Base64?⌄
Standard Base64 uses + and / in its alphabet, which are reserved characters in URLs. URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _ so the encoded string can appear in a URL path or query parameter without percent-encoding. The = padding character is also often omitted. This tool decodes only the standard alphabet; replace - with + and _ with / before decoding a URL-safe string.
Why does Base64 output end with one or two equals signs?⌄
Base64 encodes every 3 bytes of input as 4 characters. When the input length is not a multiple of 3, one or two = padding characters are appended to make the total output length a multiple of 4. They carry no data — just alignment.
Will this tool handle binary files like images or PDFs?⌄
Text only. Encode reads the text box, and Decode only shows output that is valid UTF-8 text, so Base64 of binary data such as an image shows Invalid Base64 input. For images, use the Image Base64 Converter; for other files, use a command-line tool such as base64.
Why does my encoded output differ between this tool and another Base64 encoder?⌄
The most common cause is character encoding. If the other tool encodes the string as Latin-1 (ISO-8859-1) instead of UTF-8, you will get a different result for any non-ASCII character. This tool always uses UTF-8, which is the modern standard.
Can I decode a Base64 string that has whitespace or line breaks in it?⌄
Yes. The tool strips whitespace before decoding, which handles the common case of Base64 encoded with line wrapping at 76 characters (as used in PEM certificates and MIME email bodies).
What happens if I try to decode an invalid Base64 string?⌄
The tool shows the message Invalid Base64 input and clears the result. This covers characters outside the standard alphabet (including URL-safe - and _), a truncated string, and data that decodes to bytes that are not valid UTF-8 text.
Does this tool support Base32 or Base58 encoding?⌄
This tool covers Base64 and URL-safe Base64. Base32 is used in TOTP secrets and DNS records; Base58 is used in cryptocurrency addresses — both have different alphabets and padding rules and are separate tools.
Glossary
- Base64
- An encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). Defined in RFC 4648.
- URL-safe Base64
- A Base64 variant defined in RFC 4648 §5 that substitutes - for + and _ for / so the encoded string is safe to use in URLs and filenames without percent-encoding.
- Padding
- The = characters appended to Base64 output to ensure the total length is a multiple of 4. Required by strict parsers but often omitted in URL contexts.
- TextEncoder
- A browser Web API that converts a JavaScript string to a Uint8Array of UTF-8 bytes, enabling correct Base64 encoding of non-ASCII characters.
- Data URI
- A URI scheme (data:mediatype;base64,<encoded>) that embeds file content directly in HTML or CSS, using Base64 to represent binary data as ASCII text.
- MIME
- Multipurpose Internet Mail Extensions — the standard that defines how email attachments and multipart bodies are encoded, commonly using Base64 for binary parts.
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.
Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.
✳
✳
✓ Free to use✓ No sign-up✓ 500+ possibilities