Skip to main content
DevTool House

Base64 Encode / Decode

Base64 encoder decoder

About Base64 Encode / Decode

Convert text or binary data to Base64 encoding, or decode Base64 strings back to readable text — instantly in the browser without any server-side processing.

Last reviewed

June 23, 2026

Key Features

  • Encode plain text or data to Base64
  • Decode Base64 strings back to plain text
  • Fast browser-based processing without uploads
  • Handles UTF-8 and standard ASCII input
  • Copy-ready output with no account needed

How to Use Base64 Encode / Decode

  1. 1Choose encode or decode mode.
  2. 2Paste your text or Base64 string into the input.
  3. 3Run the conversion and review the output.
  4. 4Copy the result for use in your code, config, or workflow.

API authentication header example

Basic Auth headers require Base64-encoded credentials in the format username:password. Encode the combined string here and prefix the result with "Basic " to form a valid Authorization header value.

How Base64 encoding works

Base64 represents bytes using only 64 safe characters: A-Z, a-z, 0-9, + and /. It reads the input three bytes (24 bits) at a time and splits them into four 6-bit groups, and each 6-bit value from 0 to 63 picks one character. That is why the output is always about a third longer than the input: every 3 bytes become 4 characters.

When the input length is not a multiple of three, the last group is padded and = signs fill the gap: one = when two bytes are left over, two when one byte is left over. Text is converted to UTF-8 bytes first, so characters outside ASCII, such as é or Urdu letters, take two or more bytes each before they are encoded.

Base64 is an encoding, not encryption. Anyone can decode it, so it hides nothing. Use it to carry data safely through systems that only accept text, never to protect secrets.

Two ASCII bytes and one padding character
Input:   Hi
Bytes:   0x48 0x69
Base64:  SGk=
Non-ASCII text is encoded as UTF-8 first
Input:   é          →  w6k=
Input:   سلام       →  2LPZhNin2YU=
A Basic Auth header
Input:   admin:s3cret
Base64:  YWRtaW46czNjcmV0
Header:  Authorization: Basic YWRtaW46czNjcmV0

Common Problems and Fixes

"Invalid Base64 string" when decoding
The decoder accepts only A-Z, a-z, 0-9, + and /, with at most two = at the end; spaces and line breaks are ignored. Strings that contain - or _ are Base64URL, the variant JWTs use. Replace - with + and _ with /, or paste whole tokens into the JWT Decoder.
The decoded text is garbled
The original data was probably binary, such as an image, a PDF or a compressed file, or text in an encoding other than UTF-8. This tool decodes to UTF-8 text, so binary data cannot be shown meaningfully.
The encoded output looks different from another tool's
Some tools insert a line break every 76 characters (the MIME style used in email) or produce Base64URL without padding. The data is the same; only the formatting differs.

How It Works

The tool applies standard Base64 encoding (RFC 4648) to the input. Encoding converts bytes to a 64-character alphabet; decoding reverses the process to recover the original data.

Privacy Notes

Input is processed in the browser. Avoid encoding sensitive credentials, long-lived API keys, or private data through online tools.

Limitations

The tool handles plain text and UTF-8 input. Binary files such as images or PDFs cannot be pasted directly — use a file-based tool or command-line utility for binary Base64 encoding.

Frequently Asked Questions