Base64 encoder / decoder
Convert UTF-8 text to and from standard or URL-safe Base64.
base64Encode URL components or full URLs, including Unicode, spaces, plus signs and percent signs. Diagnose double encoding and malformed URI sequences locally.
Component mode uses encodeURIComponent; full URL mode preserves separators such as /, ? and &. Decoding does not treat a plus sign as a space.
a+b &中Component mode returns a%2Bb%20%26%E4%B8%AD. A literal + is not automatically decoded as a space.
Component mode escapes separators such as &, = and ? and is suitable for one value. Full URL mode preserves URL structure, but cannot decide whether a particular & is a separator or part of a value.
A common cause is encoding %20 again, turning % into %25. Identify the encoding stage first instead of repeatedly decoding without checking.
Percent escapes need valid hexadecimal byte sequences and a valid decoded encoding. Check for truncation, repeated transformations or a different source character encoding.
Compare component and full-URL encoding with a+b &中. Understand %20, + and %2520, then verify a query-value round trip.
Read guide BASE64Encode Hello, 世界, compare alphabets and padding, and understand UTF-8 text limits when decoding JWT segments or binary data.
Read guide