Base64 is a way of writing any data, whether text, an image or a PDF, using only 64 safe characters. It exists because many places that carry data, such as JSON, email, HTML and URLs, cope with plain text but break on raw bytes. Our free Base64 Encoder/Decoder converts both ways in your browser: text or files to Base64, and Base64 back to readable text or the original file.
This guide explains how to use the tool, what each option really changes, how data URLs fit in, and what to do when it reports an error.
What Base64 Encoder/Decoder does
In Encode mode, the tool reads your text, or a file you choose, and prints the Base64 version. In Decode mode, it reads a Base64 string or a data URL and shows the original text, or offers the original file for download.
It also works out the size effect for you. Under the panels, three numbers appear: Input, Output and Size change. For text input, Input is in bytes and Output is in characters. Remember the rule: 3 bytes become 4 characters, so Base64 is roughly a third larger than the data it carries.
What it does not do is protect anything. Base64 is an encoding, not encryption, and anyone can reverse it. Do not use it to hide a password or an API key.
How to use Base64 Encoder/Decoder, step by step
To encode text
- Open Base64 Encoder/Decoder.
- Leave Mode on Encode.
- Type or paste your text into the box labelled "Plain text (UTF-8)".
- Read the Result panel. It updates as you type. Press Copy to copy it, or Download to save a
.txtfile.
For example, Hello, world! gives SGVsbG8sIHdvcmxkIQ==. The Bangla word বাংলা gives 4Kas4Ka+4KaC4Kay4Ka+, because the text is converted to UTF-8 bytes first and each Bangla letter takes three bytes.
To encode a file
- In Encode mode, press Choose file in the top corner of the left panel and pick any file.
- The text box is replaced by a note with the file name and size, and a Remove button.
- Copy the Base64 from the Result panel, or press Copy data URL to get the whole
data:link in one go. The Change file button lets you swap the file.
To decode
- Switch Mode to Decode.
- Paste the Base64 into the box labelled "Base64 string or data URL".
- If the data is text, it appears in the Result panel. If it is a file, you see a note saying "This decodes to binary data" with its size, a preview of the first bytes in hex, and a Download decoded file button.
When you switch the Mode, the tool moves the current result into the input box. So encode a sentence, switch to Decode, and you see the same sentence come back. This is a quick way to check that a round trip works.
Every option explained
URL-safe (base64url)
Standard Base64 uses + and /, which have special meanings in URLs, and pads the end with =. The URL-safe form swaps + for -, swaps / for _ and drops the = padding. It is used in JWTs, in file names and in query strings. For example, the text subjects?_d=1>> gives:
| Variant | Result |
|---|---|
| Standard | c3ViamVjdHM/X2Q9MT4+ |
| URL-safe | c3ViamVjdHM_X2Q9MT4- |
The checkbox appears in Encode mode only. In Decode mode you do not need to choose: the decoder accepts both alphabets, and also accepts input where the padding is missing.
Wrap lines at 76 chars
This puts a line break after every 76 characters. That is the line length used by email (MIME). Leave it off for everything else. The break characters are counted in the Output figure, which makes it a little bigger.
Copy data URL
A data URL has the form data:image/png;base64,iVBORw0.... This button appears only after you have chosen a file in Encode mode, because it needs the file's type. The type comes from your browser. If the browser does not know it, application/octet-stream is used, which is a general "binary file" label. Any wrapping line breaks are removed from the copy.
The button always builds the data URL with standard Base64 (with +, / and = padding) and on one line, whatever the URL-safe and Wrap lines options say, because browsers cannot decode the base64url form inside a data URL. So ticking URL-safe changes only the Result panel, not the data URL. The step-by-step for using one in a web page is in how to embed an image in HTML or CSS as Base64.
What it accepts and its limits
- Text to encode: any text. It is encoded as UTF-8 exactly as you typed it, including trailing spaces and line breaks.
- Files to encode: any file type. The page sets no size limit; your device's memory is the limit.
- Base64 to decode: standard or URL-safe Base64, with or without padding, with spaces and line breaks anywhere, and with a leading
data:...;base64,prefix, which is removed for you. The input is trimmed. - Text result: shown when the decoded bytes are valid UTF-8.
- Binary result: anything else. The saved file is named "Tech Solution Point - Base64 decoded" plus an extension. If you pasted a data URL, the type it names is used (
data:image/pnggives.png). Otherwise the tool recognises common types from the first bytes of the file (PNG, JPG, GIF, WebP, PDF, ZIP, GZIP, BMP, WAV, MP3 and ICO). Only data it cannot recognise is saved as.bin; rename it to its true type. - Not accepted: a data URL that is not Base64, such as an SVG written with percent-encoding. The tool strips only the
;base64,form, so the rest is reported as invalid.
Privacy
Encoding and decoding run in your browser. Your text and files are not uploaded to our server. That matters here, because people often paste tokens, keys and customer data into Base64 tools. Still, remember that the output is trivially reversible, so treat an encoded secret exactly like the secret itself.
Tips to work faster
- Test a round trip by switching Mode: whatever you encode should come back identical.
- To read part of a JWT, paste one piece between the dots into Decode. The JWT Decoder splits all three parts for you.
- When a service asks for "Basic" login details, the text
user:passwordencoded with the standard alphabet is the format it expects. It is only a format, not protection, so use it only over HTTPS. - Shrink a picture before encoding it, because the Base64 copy will be about a third bigger than the file. The Image Compressor is made for that.
- If your text has accented letters, Bangla or emoji, you do not have to do anything. UTF-8 is used automatically.
Common problems and how to fix them
"The input contains characters that aren't valid Base64."
Something in the box is not part of the Base64 alphabet. Look for quote marks, commas, a stray < or dots. A whole JWT, for instance, is three Base64 pieces separated by dots, and the dots are not Base64, so paste one piece at a time. If you copied from a JSON file, remove the quotes around the string.
"The Base64 input has an invalid length."
A valid Base64 string never ends with exactly one leftover character after the groups of four. Almost always the string is cut off, because it was copied incompletely or a line was lost. Copy it again from the source.
The result is hex numbers and a download button, not text
The decoded bytes are not valid text. Either it is a real file, such as an image or PDF, or the text was saved in a different encoding from UTF-8. Download it and open it (the file gets its real extension when the tool recognises the type, otherwise .bin, which you can rename). If it was meant to be text in an old encoding, open it in an editor that lets you pick the encoding.
The decoded text has strange characters
The text was probably encoded twice, or the original used a different character set. Decode the result again. If the output of the first decode looks like another Base64 string, that is double encoding.
The same text gives a different result in another tool
Check three things: the URL-safe setting, a trailing line break in your input, and whether the other tool uses UTF-8. Our encoder takes your input exactly as typed, so a trailing Enter changes the answer.
Related tools
- URL Encoder: percent-encoding for characters inside a link. Its complete guide explains when to use it instead of Base64.
- JWT Decoder: read the header and payload of a token in one step.
- Image Compressor: make a picture smaller before you turn it into a data URL.
- Developer Tools: the rest of our encoders and formatters.
Quick checklist
- Use Encode for text or files, Decode for strings and data URLs.
- Tick URL-safe only for URLs and tokens; Copy data URL always uses standard Base64.
- Expect the output to be about a third bigger.
- Check the extension of a downloaded file; a file the tool cannot recognise is saved as .bin and needs renaming.
- Never treat Base64 as a way to keep something secret.



