An integration may provide a Base64url value while the next text field expects standard Base64. A rejected underscore is a clue to check the alphabet before changing the original text. First confirm the required format in the receiving API documentation: alphabet, padding and line breaks are separate decisions.
The Base64 Encoder and Decoder can help with a known UTF-8 text example. This guide converts an existing encoded value between variants; our Unicode Base64 guide covers the earlier text-to-bytes step.
Identify the alphabet and padding requirements
RFC 4648 defines Base64url with two alphabet substitutions. To obtain the standard alphabet, replace - with + and _ with /. Letters and digits stay unchanged; letter case matters.
Padding is a separate rule. Base64url does not universally mean unpadded data. Follow the receiving specification rather than deleting or adding equals signs by habit. Standard padded output completes its final group with zero, one or two = signs.
Convert a public test value
Use the deliberately short text ÿ??: one lowercase y with diaeresis followed by two question marks. It makes the alphabet change and padding visible without using an account token.
Text: ÿ??
UTF-8 bytes in hex: c3 bf 3f 3f
Base64url, unpadded: w78_Pw
Standard, padded: w78/Pw==
- Open the tool and choose Decode Base64 to text under Mode.
- Paste
w78_Pwinto Input. Leave URL-safe alphabet (- and _) unchecked. This decoder accepts the URL-safe symbols independently of that encoding option. - Click Convert. Confirm the output is exactly
ÿ??, with Decoded bytes showing4 B. - Keep URL-safe alphabet (- and _) unchecked and also uncheck Wrap output at 76 characters.
- Click Use output as input. It switches to encoding and immediately converts the decoded text. The output should become
w78/Pw==. - Check that exact output before selecting Copy.
For the reverse test, encode the same text with URL-safe enabled and wrapping disabled. This tool returns w78_Pw, because its URL-safe setting also removes trailing padding. That behavior describes this tool, not every Base64url format.
Check a conversion before sending it
Record the input variant, expected text and required destination variant alongside your test. Compare the complete result, including case and the end of the string. In this fixture, changing the underscore to a slash is only part of the job: the destination also expects two padding signs.
Leave wrapping off for a destination requiring one uninterrupted value. With a multiline sample, Strip whitespace before decoding removes whitespace from the encoded input. It does not remove spaces from the decoded message. Do not enable it merely to hide an unexplained change in copied data.
Handle errors without guessing missing characters
A length error appears
After omitted padding is excluded, an otherwise valid encoded value cannot have a length leaving a remainder of one when divided by four. For example, w78_P is not a repairable shortened version of our fixture. Retrieve the complete value instead of guessing its final character.
The tool accepts a suspicious value
Successful decoding is not strict format validation. The implementation tolerates omitted padding and rebuilds padding after removing trailing equals signs. It does not enforce every canonical-encoding rule. A destination with stricter requirements can still reject that input.
Use bytes when exact preservation matters
This tool interprets decoded bytes as UTF-8 text. Its default TextDecoder can replace malformed sequences and skip an initial byte order mark, as described in MDN’s decoder options. Re-encoding that text is therefore not a reliable way to preserve every possible byte sequence.
For files, unknown encodings or byte-exact integrations, use a byte-oriented conversion instead. MDN documents Uint8Array.fromBase64(), which decodes either alphabet to bytes with explicit options; check browser support before using it in an application.
Changing representation does not encrypt the content, verify a signature or authenticate its sender. Keep authentication checks in the receiving application and use public test values while diagnosing format mismatches.