Encoding Tools

Base64 decoder.

Paste Base64 and read the text. Handles standard and URL-safe alphabets, MIME line breaks, missing padding and data: URIs, and tells you exactly which character or length is wrong. Runs in your browser; nothing is uploaded.

Short answer: paste the Base64 into the box below and the text appears above it. SGVsbG8sIFdvcmxkIQ== decodes to Hello, World!. Both alphabets are accepted, whitespace is ignored, and a bad character, length or padding is reported by position.

Sources: RFC 4648 sections 3 to 5 and 10; RFC 7515 section 2; WHATWG Infra and HTML standardsRetrieved October 2026

Advertisement

Text and Base64

Result

How Base64 works

Decoding reverses the encoding: each character gives back a 6-bit value, four characters make 24 bits, and those are cut into 3 bytes. TWFu is the values 19, 22, 5, 46 and decodes to the bytes 77, 97, 110: Man. The bytes are then read as UTF-8 text; if they are not valid UTF-8 the tool reports binary data instead of showing replacement characters.

Source: RFC 4648 section 4, rfc-editor.org/rfc/rfc4648.

Examples

Press Try to load an example into the text box.

foobar, foob and fooba are RFC 4648 section 10 test vectors; every row is checked by this tool’s automated tests.
TextBase64NoteLoad
foobarZm9vYmFyRFC 4648 section 10 test vector. 6 bytes make exactly 8 characters, so no padding.
foobZm9vYg==RFC 4648 test vector. 4 bytes leave 1 over, so two "=" pad the last group.
foobaZm9vYmE=RFC 4648 test vector. 5 bytes leave 2 over, so one "=".
Hello, World!SGVsbG8sIFdvcmxkIQ==The usual first example.
€4oKsThe euro sign is 3 UTF-8 bytes (E2 82 AC). Plain btoa() cannot take it.
hélloaMOpbGxvAn accented letter takes 2 UTF-8 bytes.
ab?>YWI/Pg==Standard output has "/". URL-safe gives YWI_Pg (tick URL-safe and no padding).
foobar\nZm9vYmFyCg==A trailing newline changes the result: always check what you pasted.

Unicode, URL-safe and padding

Unicode. Base64 encodes bytes, not characters, so text must first become bytes. This tool uses UTF-8. The browser’s btoa() instead throws an InvalidCharacterError for any character above U+00FF, which is why € or an emoji fails there. Source: HTML Standard, btoa().

URL-safe (base64url). Section 5 of RFC 4648 swaps + for - and / for _ so the result can sit in a URL or file name. JSON Web Tokens use this alphabet with the trailing = removed (RFC 7515 section 2); the JWT decoder splits a whole token for you.

Padding. RFC 4648 section 3.2 requires = padding unless the specification using Base64 says otherwise. The decoder accepts missing padding, as the browser’s own forgiving-base64 rules do (WHATWG Infra), and notes it. It rejects padding that is the wrong length, padding in the middle, and a single leftover character.

Line breaks. MIME limits encoded lines to 76 characters (RFC 2045 section 6.8), so Base64 copied from an email is often wrapped. The decoder ignores spaces and line breaks. This tool does not add line breaks when encoding.

Images and files. To turn an image into Base64, use the Image to Base64 (Data URI) generator. To turn Base64 back into an image or PDF, use the Base64 to File decoder.

Frequently asked questions

How do I decode a Base64 string?

Paste it into the Base64 box. The text appears above it immediately. If the string is not valid Base64, the message under the boxes names the first bad character and its position, or says what is wrong with the length or padding.

Why does the decoded result look like garbage, or the tool says binary?

The bytes are not valid UTF-8 text, so they are probably a file (an image, PDF or archive) rather than words. The tool shows the first bytes in hex and links to the Base64 to File decoder, which previews and downloads the file.

Can it decode a JWT or base64url string?

Yes for the encoding: the URL-safe alphabet (- and _) is detected and missing padding is accepted. Paste one segment of a token to read it. To split a whole token and format its JSON claims, use the JWT decoder.

What if my Base64 has line breaks or spaces?

They are ignored. MIME email limits encoded lines to 76 characters (RFC 2045 section 6.8), so wrapped Base64 is common, and the WHATWG forgiving-base64 rules also strip whitespace.

What does "Invalid length" mean?

After removing padding, a valid Base64 string never has 1 character left over in its last group of 4, because one 6-bit character cannot hold a whole byte. It usually means the string was cut off when copied.

Is my Base64 uploaded?

No. Decoding runs in your browser with the script on this page. The text you paste is not sent to a server by this tool.

Advertisement
Advertisement