Encode text or file bytes as Base64
Use the Base64 Encoder / Decoder to represent UTF-8 text or a small file as a string, or recover bytes from an encoded value. Conversion runs in your browser without an account. Choose the format required by the system that will receive the result.
Base64 is reversible encoding, not encryption. It does not hide passwords, protect tokens, or prove that a file is safe. Decoded text is displayed as text; HTML and SVG are not executed or previewed.
| Input | Mode and controls | Result |
|---|---|---|
| Plain text, including emoji and non-Latin scripts | Encode; choose alphabet and padding | Base64 representation of UTF-8 bytes |
| A local file | Encode a file; choose Data URL or Base64 only | Encoded bytes, with an optional media-type header |
| Raw Base64 | Decode; select the matching alphabet | Original bytes and text when valid UTF-8 |
data:...;base64,... |
Decode; its payload uses Standard Base64 | Original payload bytes; selected raw-input alphabet is ignored |
Type or paste text to update the result. Selecting a file replaces the text input. Typing text afterward replaces the selected file. Changing mode clears the file selection but retains the text input; use Swap to move a nonempty text result into the opposite mode.
Choose Standard Base64 or Base64url
Standard Base64 uses letters, digits, +, and /, with optional final = characters for padding. Encode defaults to including padding. Base64url uses - and _ instead of + and /; this tool defaults to omitting padding for that choice. The checkbox lets you change the encoding output.
The alphabet and the padding policy are separate choices. A receiving protocol may require or forbid padding. Do not remove = simply because a string is going into a URL, and do not assume that changing two characters makes every system accept it.
For the two bytes FB FF in hexadecimal:
| Output choice | Encoded value |
|---|---|
| Standard, padded | +/8= |
| Base64url, padded | -_8= |
| Base64url, unpadded | -_8 |
In Decode, select the alphabet used by a raw string. Both choices accept correctly padded or unpadded values. The decoder ignores spaces, tabs, carriage returns, and line feeds so you can inspect wrapped input. It rejects other characters, mixed alphabets, impossible lengths, misplaced padding, and non-zero unused padding bits. These are the tool's acceptance rules; another protocol may be stricter about whitespace or require padding.
A complete JWT contains multiple parts and is not one Base64 string. Use the JWT Decoder to inspect its structure. Decoding a JWT does not verify its signature or establish trust.
Encode a file or read a Base64 data URL
Choose Encode a file… to select a local file up to 5 MiB, or 5,242,880 bytes. This is a file picker, not a drag-and-drop area. The default file output is a Base64 data URL:
data:text/plain;base64,SGVsbG8=
The header identifies a media type; the comma separates it from the encoded payload. The file's browser-reported type is used when it is a simple valid media type. Otherwise the tool uses application/octet-stream. A type label does not validate the contents, and the data URL does not preserve the original filename.
Select Base64 only to omit the header and enable alphabet and padding controls for the file bytes. Data URL output always uses padded Standard Base64.
Decode accepts Base64 data URLs with a short media-type header and simple parameters such as charset=utf-8. It does not support non-Base64 data URLs or arbitrary header syntax. The decoded bytes are preserved regardless of the declared charset; the text view attempts UTF-8 only. A charset declaration does not make the tool transcode Latin-1 or UTF-16.
Inspect text and download original bytes
A valid Base64 string can represent text, an image, an archive, or any other bytes. Successful Base64 decoding does not imply that the result is readable text.
The text view uses strict UTF-8 decoding. Accents, emoji, line breaks, spaces, and a UTF-8 byte order mark are preserved. If the bytes cannot be decoded as UTF-8, the tool explains this and disables Copy and Swap instead of substituting �. Download decoded file remains available and preserves the exact bytes.
For example, SGVsbG8= decodes to Hello. /w== decodes to the single byte FF, which is not valid UTF-8 by itself. That second result belongs in a byte download, not a replacement-character text export.
Use the JSON Formatter to inspect decoded JSON, or the Text Diff Checker to compare readable results. Neither Base64 decoding nor text formatting validates an API token or authorizes a request.
Understand image previews
Decode can preview PNG, JPEG, GIF, and WebP when their initial byte signatures match a supported format. For a data URL, its declared type must agree with the detected format, or be application/octet-stream. Raw Base64 can also be recognized without a header.
Signature detection is a preview hint, not a complete file check. If the browser cannot display the image, a message replaces the broken preview and the byte download remains available. SVG, HTML, and other document formats receive no rendered preview. A decoded file can still contain untrusted data.
Copy, download, swap, and reset
| Action | Behavior |
|---|---|
| Copy | Copies the encoded output in Encode, or valid nonempty UTF-8 text in Decode |
| Download encoded text | Saves the displayed Base64 or data URL as base64-encoded.txt |
| Download decoded file | Saves the original decoded bytes, including a UTF-8 BOM |
| Swap | Moves a nonempty text result into the opposite mode; unavailable for non-UTF-8 bytes |
| Reset | Clears text and file data and restores Encode, Standard Base64, padding, and the default file-output choice |
| Share | Shares the tool page link; it does not attach the input or result |
Decoded filenames are generated by the tool, not recovered from the source. Recognized raster images receive a matching extension; other UTF-8 results use .txt, and other bytes use .bin. Downloads are sent as attachment bytes, not rendered as the declared media type. A valid empty data URL can produce a zero-byte download even though Copy and Swap have no text to use.
While a file is being read, or when conversion fails, older results are unavailable and Copy, Download, and Swap are disabled. Reset, a new file, text editing, or a mode change cancels the effect of an older pending read.
Size limits and common decoding errors
Files, UTF-8 source bytes, and decoded bytes are limited to 5 MiB. Decode input is limited to 7,340,032 characters, including its header and whitespace; data URL headers are limited to 1,024 characters before the comma. Browser memory still holds input and output together, so use normal uploads for large assets.
Padded Standard Base64 uses 4 × ceil(byte count / 3) output characters before any data URL header. Three bytes become four characters. The approximate one-third increase describes longer inputs; short inputs have larger proportional padding overhead, and Unicode characters can occupy multiple UTF-8 bytes.
If decoding fails, check the selected alphabet, missing or extra characters, quotes copied around the string, an unsupported data URL header, and padding placement. The tool does not turn URL percent-encoded input into Base64 first. Use the URL Encoder / Decoder for that separate format. See URL Encoding vs Base64 for protocol examples.
Privacy and processing
The converter uses tab memory and does not upload inputs or save them in local storage. Its analytics event payloads include action, mode, or alphabet information, without text, filenames, media types, or file contents. Input and result regions are marked for Clarity masking; site analytics follow the site's consent settings.
Copy puts text on your clipboard, which may have history or sync. Downloaded files persist separately. Reset clears the tool's current state; it does not erase those other copies. Local conversion and reversible encoding are different claims: Base64 itself supplies no confidentiality.