How to Check a Base64 String
A decoder that refuses a string usually says little more than "invalid input". Paste the string here to find out exactly where it goes wrong, or, if it is fine, which decoders might still trip over it.
Paste the Base64 string
Paste the string into the input panel. It can be split over several lines, wrapped in the quotes you copied it with, or start with a data: URI prefix. The Sample button loads a short valid string.
Read the verdict
A moment after you stop typing, the badge shows Valid or Invalid. While the check is catching up with an edit it says Checking…, so an old result is never shown for new text.
= in the middle, too many at the end, or the wrong number for the length.Look at the details
For a broken string you see the problem and its line and column. For a valid one you see the alphabet, the padding, any notes about decoders that might refuse it, the decoded size and what the data looks like.
What Makes Base64 Valid?
RFC 4648 defines Base64 as groups of four characters, each standing for three bytes. The characters come from a 64-letter alphabet: A–Z, a–z, 0–9 and two more, + and / in standard Base64 or - and _ in the URL-safe variant. If the data does not fill the last group, = signs pad it out to four characters.
That leaves only a few ways to go wrong: a character from outside the alphabet, padding in the wrong place or in the wrong amount, a length no complete string can have, or a mix of the two alphabets. Everything else, such as line breaks in data URLs or MIME email, is a matter of how forgiving the decoder is, which is what the notes in the results are about.
Frequently Asked Questions
What does this validator actually check?
It reads the string character by character and checks that every character belongs to one Base64 alphabet, that = padding appears only at the end and in the right amount for the length, and that the string is not cut off (a group of four holding a single character can never be complete). Then it decodes the string and encodes the bytes again to make sure the result matches. When something is wrong you get the first problem with its line and column; when it is fine you see the decoded size, the kind of data inside and, for text, the decoded text itself.
What does it not check?
It cannot tell whether the decoded bytes are the right ones. A JWT with a bad signature, an image cut short before it was encoded, or JSON with a typo all look like perfectly valid Base64. The page names known file types (PNG, PDF, ZIP and so on) from their first bytes and shows text as text, but it does not open the file or check its insides.
What is the difference between standard and URL-safe Base64?
Standard Base64 (RFC 4648) uses + and / for its last two characters. Those mean something in URLs and file names, so the URL-safe variant uses - and _ instead; JWTs, many web APIs and some cloud tools use it. The validator tells you which alphabet a string uses. A string that mixes + or / with - or _ is reported as an error, because almost every decoder accepts only one of the two at a time.
Is a Base64 string without = padding valid?
Usually, yes. Padding only fills the last group of four characters, and URL-safe Base64 normally leaves it off. Node.js, browsers and Python read unpadded strings, but some strict decoders, such as Java’s Base64.getDecoder(), require it. The validator accepts such a string and tells you how many = signs it would need. The wrong number of = signs, on the other hand, is an error.
Why does one program decode my string while another rejects it?
Decoders differ in how forgiving they are. Node.js quietly skips characters it does not know, reads both alphabets at once and ignores wrong padding; the browser’s atob() and Java are much stricter; Python skips stray characters unless you pass validate=True. Line breaks and spaces are another common difference. The results panel says when a string relies on that kind of leniency, so you can fix it before it reaches the strict decoder. It also flags a last character with spare bits set: decoders read the same bytes, but encoding them again gives a slightly different string.
Is Base64 encryption, and is my data sent anywhere?
Base64 is not encryption. Anyone with the string can turn it back into the original bytes, exactly as this page does, so it should never be the only thing protecting a password or key. The check runs in JavaScript in your browser: nothing you paste is uploaded and nothing is kept, so a reload starts with an empty editor.
Related pages: Base64 Decode · Base64URL Decode · Base64 Encode · Base64 to File
Related Tools
Base64 Encoder
Encode text and data to Base64 format
Base64 Decoder
Decode Base64 encoded data back to text
Base64 URL Encoder
Encode text to URL-safe Base64 format for JWT tokens, OAuth, and web APIs
Base64 URL Decoder
Decode URL-safe Base64 strings from JWT tokens, OAuth responses, and API data
Image to Base64
Convert images to Base64 encoded strings for embedding in HTML, CSS, and APIs
Base64 to Image
Decode Base64 encoded strings to view and download images (PNG, JPG, GIF, SVG)