DevTools Hub

Base64 Encoder / Decoder

Encode text to Base64 or decode it back, with full UTF-8 and URL-safe (Base64URL) support. Client-side only — nothing leaves your browser.

Plain text

0 characters

Base64

Output appears here.

How to use the Base64 Encoder / Decoder

Choose Encode to turn text into Base64, or Decode to read a Base64 string back as text. The conversion runs as you type, entirely in your browser.

Tick URL-safe (Base64URL) when the value has to travel inside a URL, a filename or a JWT. That variant replaces the plus and slash characters with hyphen and underscore and drops the trailing equals-sign padding.

Use Swap to feed the output back into the input with the direction reversed — the quickest way to confirm a value round-trips cleanly.

Input is treated as UTF-8, so emoji, accented characters and non-Latin scripts all encode and decode correctly rather than throwing the range error the browser's raw btoa produces.

Examples

Encode textStandard Base64, with padding.
Input
devtools-hub
Output
ZGV2dG9vbHMtaHVi
Encode for a URLURL-safe output: no +, / or = characters.
Input
subject?id=1&ok=true
Output
c3ViamVjdD9pZD0xJm9rPXRydWU
Decode a credential headerHTTP Basic auth encodes user:password.
Input
YWRtaW46czNjcmV0
Output
admin:s3cret

Frequently asked questions

Is Base64 a form of encryption?
No. Base64 is an encoding, not encryption. Anyone can decode it instantly without a key, exactly as this page does. Never use it to protect passwords, tokens or personal data — it only makes binary data safe to carry through text-only channels.
What is the difference between Base64 and Base64URL?
They encode the same bytes with a different alphabet. Standard Base64 uses + and / for its last two characters and pads with =. Base64URL uses - and _ instead and usually omits the padding, because +, / and = all have reserved meanings inside URLs and would otherwise need percent-escaping.
Why does Base64 make my data bigger?
Base64 represents every three bytes as four printable characters, so the encoded form is about 33 percent larger than the original, plus padding. That overhead is the price of being able to send arbitrary bytes through a text-only medium such as JSON, email or a URL.
Why did my decode fail?
Two checks can fail. Either the string contains characters outside the Base64 alphabet or has a length that is not a valid multiple of four, or the bytes decode successfully but are not valid UTF-8 text — which happens when the original data was an image or another binary format rather than text.
Can I encode a file or an image?
This tool works on text. To Base64-encode a binary file, use a command-line utility such as base64 on macOS and Linux, or certutil on Windows, then paste the resulting string here if you need to inspect or convert it to the URL-safe alphabet.

Related tools