1Tools

Input

Output

Encoding & Text

Base64 Encoder & Decoder

Encode plain text or files to Base64, or decode Base64 strings back to text and downloadable files — including Unicode, URL-safe Base64, and Data URLs. Everything runs in your browser; nothing is uploaded.

What you can do

  • Encode and decode in both directions

    Turn Input into Base64 or decode Base64 from Input into Output with one click. Swap moves Output back into Input when you need to reverse the flow.

  • UTF-8 and Unicode without mojibake

    Chinese, emoji, and other Unicode characters are encoded as UTF-8 bytes first, so decode results stay readable.

  • Files and images

    Upload a file into Input to encode it to Base64. Decode a Base64 or Data URL payload and download the restored file from Output.

  • URL-safe and Data URL options

    Switch to the URL-safe alphabet (- and _), strip or keep padding, and wrap output as a data: URL when you need it for HTML.

  • Clear error diagnosis

    When decoding fails, the tool points to illegal characters, bad length, padding mistakes, or binary payloads that should be downloaded as a file.

How to use

  1. 01

    Paste text or Base64 into Input, or upload a file there.

  2. 02

    Click Encode or Decode. The result appears in Output. Use Swap to move Output into Input.

  3. 03

    Copy or download from either pane. Toggle URL-safe, padding, or Data URL options before encoding when you need those formats.

About Base64

  • What Base64 is

    Base64 is a binary-to-text encoding defined in RFC 4648. It maps arbitrary bytes to 64 printable ASCII characters so binary data can travel safely through systems that expect text — early email, HTTP headers, configuration files, and similar channels. It was designed in the 1990s for transport, not for secrecy.

  • How encoding works

    The encoder reads input in 3-byte (24-bit) groups, splits each group into four 6-bit values, and maps each value to one character in the 64-character alphabet. Three input bytes become four output characters, so the encoded length is always a multiple of four. When the final group is shorter than three bytes, the encoder appends one or two = padding characters.

  • Standard vs URL-safe alphabet

    The standard alphabet is A–Z, a–z, 0–9, +, and /. URL-safe Base64 (base64url) replaces + and / with - and _ so the string can sit in a URL or filename without escaping. The two alphabets are not interchangeable; convert before mixing them.

  • Padding and concatenation

    Padding with = marks incomplete final groups: one = means the original group had two bytes; two = means one byte. Decoders may accept strings with padding omitted, but you cannot concatenate padded Base64 fragments by simply joining them. Strip trailing padding from each piece, concatenate the payloads, then pad the combined result once.

  • Size expansion (~33%)

    Encoded output is about 4/3 the size of the original bytes — roughly a 33% increase. That expansion is the cost of carrying binary data as text.

  • Unicode and UTF-8

    Base64 itself is pure ASCII. For Unicode text, the correct path is UTF-8 bytes first, then Base64. Encoding code units incorrectly is the usual reason Chinese or emoji turns into mojibake after a round trip.

  • Common uses

    Typical uses include HTTP Basic Auth headers, embedding small assets as Data URLs, the header and payload segments of a JWT (usually base64url without padding), SMTP attachments, passing binary values in URL parameters, and embedding binary blobs in older XML formats.

  • Encoding, not encryption

    Base64 is encoding, not encryption. There is no key. Anyone who receives the string can decode it immediately. Do not store passwords or secrets as Base64 and expect them to stay confidential — use it for transport and local debugging only.

How to Encode Base64

Encoding turns bytes into a Base64 string. Use it when you need to embed binary data in JSON, HTML, or a text-only channel.

  1. 01

    Type or paste plain text into Input, or upload a file. Unicode is handled as UTF-8 automatically.

  2. 02

    Optionally enable URL-safe alphabet, strip padding, or wrap the result as a Data URL.

  3. 03

    Click Encode. The Base64 string appears in Output — copy or download it.

Text: Hello, 1Tools!
Base64: SGVsbG8sIDFUb29scyE=

How to Decode Base64

Decoding restores the original bytes from a Base64 string. Use it to read encoded payloads or recover a file from a Data URL.

  1. 01

    Paste a Base64 string or Data URL into Input. Whitespace and line breaks are ignored.

  2. 02

    Click Decode. Readable UTF-8 text appears in Output; if the payload is binary, download it as a file instead.

  3. 03

    If decoding fails, check for illegal characters, length not divisible by four, or padding in the wrong place.

Base64: SGVsbG8sIDFUb29scyE=
Text: Hello, 1Tools!

Private, local, and honest

  • 100% in your browser

    Encoding and decoding run locally. There is no upload endpoint and no copy of your data on a server.

  • No sign-up

    Open the page and start. No account, login, or API key.

  • Encoding, not encryption

    Base64 is for transport and debugging. It does not protect secrets.

  • Works with files

    Text, images, and other binaries can be encoded or restored as downloads.

FAQ

Image to Base64Base64 to ImageJSON Formatter & ValidatorJSON Diff & CompareText Diff & CompareMarkdown PreviewAll toolsBack to home