How to use the Text to Base64 tool
- Type or paste your content into the Text box. Select Example to fill in a sample greeting.
- Select Encode to convert the text to UTF-8 and then to Base64.
- Read the encoded string in the Result box. It is one line, with = padding where needed.
- Select Copy to place the Base64 on your clipboard.
How text to Base64 encoding works
Base64 encodes bytes, not characters, so text must become bytes first. This tool uses UTF-8, where ASCII characters take one byte, most accented and Cyrillic letters two, most CJK characters three, and most emoji four. The bytes are then cut into 6-bit groups, and each group selects one of 64 characters: A-Z, a-z, 0-9, + and /.
Take the word Man. Its bytes are 77, 97 and 110, or 01001101 01100001 01101110 in binary. Regrouped by six bits that is 010011 010110 000101 101110, the values 19, 22, 5 and 46, which map to T, W, F and u. When the input length is not a multiple of three, the last group is filled with zero bits and = signs complete the block of four.
Man → TWFu
Ma → TWE=
M → TQ==
Hello, world! → SGVsbG8sIHdvcmxkIQ==
é → w6k=
你好 → 5L2g5aW9Output format of the encoder
The result follows one fixed format. For a URL-safe result without padding, use the Base64 tools page, which has an Encoding alphabet option, or run the output through Normalize Base64.
- Standard alphabet from RFC 4648 section 4, with + and /.
- Padding with = is always included.
- A single line. No line breaks are inserted at 64 or 76 characters.
- Length is four characters for every three input bytes, rounded up to a full block.
Whitespace is data
The encoder does not trim anything. A trailing space or a final line break in the Text box becomes part of the output, and that is the most common reason two tools disagree. Running echo with a string and piping it to base64 in a shell appends a line feed, so the greeting from the example ends in IQo= there and in IQ== here. Use printf or echo -n to match.
Line breaks inside the box reach the encoder as a single line feed byte, 0A, even if the text was copied from a Windows file that used carriage return plus line feed. If you need the exact bytes of a file, including its original line endings or a byte order mark, use File to Base64.
Common uses for encoded text
Developers encode text to build Basic authentication tokens from user:password pairs, to fill the data fields of Kubernetes Secret manifests, to embed small snippets in data URLs, and to pass strings through systems that mangle quotes or newlines. The result is about 33% longer than the UTF-8 input and offers no secrecy: anyone can reverse it with Base64 to Text.
Frequently asked questions
Is my text sent to a server for encoding?
No. The encoding runs in your browser with the built-in TextEncoder and btoa functions. What you type stays in the page.
Why does my result differ from the base64 command?
The shell usually adds a line break to the input, and this tool does not. Compare without the trailing newline, for example with printf instead of echo. Also check that both sides use UTF-8.
Does it handle emoji and non-Latin scripts?
Yes. Characters are converted to UTF-8 before encoding, so every Unicode character works. The JavaScript btoa function alone would throw on such input; this tool avoids that by encoding bytes.
How long will the Base64 output be?
Divide the UTF-8 byte count by three, round up, and multiply by four. Thirteen bytes give 20 characters. Remember that non-ASCII characters count as two to four bytes each.
Can I get Base64URL output here?
Not on this page, which always writes the standard alphabet with padding. The Base64 tools page offers a URL-safe choice that replaces + and / with - and _ and drops the padding.
Is there a length limit for the text?
The code imposes none. The bytes are processed in blocks of 32,768, so long inputs do not hit browser argument limits. Very large inputs are bounded only by memory.