Base64 encode text

Base64 encode any text and get the standard RFC 4648 alphabet back. Each three input bytes map to four A-Z a-z 0-9 + / characters, with = padding when the byte length is not a multiple of three. UTF-8 multibyte characters are handled before encoding. The transform runs in your browser; nothing uploads.

Input
Line 1:1 LF cloud_done Saved locally
Result Base64 Encode
0 lines 0 chars

Base64 encoding, byte-exact and UTF-8 safe

Base64 is a binary-to-text encoding that packs every three input bytes into four printable ASCII characters. The output uses the standard alphabet A-Z, a-z, 0-9, plus + and /, with = padding when the input length leaves one or two bytes over. Encoded output is roughly 33% longer than the input, so a 300-byte string becomes about 400 characters of base64.

TextResult runs the encode through btoa(unescape(encodeURIComponent(s))), which first widens any non-ASCII codepoints into UTF-8 bytes, then base64-encodes the byte stream. So café encodes the four bytes 63 61 66 C3 A9, not five 16-bit code units. Pure ASCII input gets the same result as a server-side base64 command.

Toggle Wrap Lines in the action bar to split the output every Line Length characters (default 76, the MIME limit from RFC 2045). Leave it off for a single-line token suitable for HTTP headers, data URIs, or JSON values. This is encoding, not encryption: anyone can decode base64. For a one-way digest, see SHA-256.

How to use base64 encode text

  1. 1Paste or type your text into the input panel on the left.
  2. 2The base64 result appears in the output panel on the right as you type.
  3. 3Toggle Wrap Lines in the action bar if you need MIME-style line breaks.
  4. 4Adjust Line Length (4-998) to match the format you are targeting.
  5. 5Click Copy in the output header to copy the encoded string.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Standard RFC 4648 alphabet with padding

Output uses A-Z a-z 0-9 + / with = padding. Length grows by roughly 4/3. A 1-byte input produces 2 chars + ==, a 2-byte input produces 3 chars + =, and a 3-byte input produces 4 chars with no padding.

UTF-8 widening for non-ASCII text

Before encoding, the string is converted to UTF-8 bytes via encodeURIComponent. café becomes the bytes 63 61 66 C3 A9, then base64s to Y2Fmw6k=. This matches the output of printf "café" | base64 on Linux/macOS.

Optional MIME line wrapping

Turn on the Wrap Lines toggle to split the output every Line Length characters with \n separators. Default is 76 (RFC 2045 MIME limit). The trailing newline is trimmed. Off by default, so the result is one continuous line.

Configurable line length, 4 to 998

When wrapping is on, Line Length accepts any integer from 4 to 998. Common values are 64 (PEM), 76 (MIME), and 998 (the SMTP line-length cap). Values below 4 round up internally.

Browser-side, no upload

Encoding runs through the native btoa on each keystroke. No server round-trip, no log of what you pasted. Safe for tokens, API keys, and any text you would not want leaving the page.

Worked example

The newline encodes as 0x0A and the é becomes the UTF-8 bytes C3 A9, so the byte sequence is 18 bytes long and ends with two = pads.

Input
Hello, world!
Café
Output
SGVsbG8sIHdvcmxkIQpDYWbDqQ==

Settings reference

Behaviour Effect on output
ASCII letters and digits Encoded as their UTF-8 byte values into the standard A-Z a-z 0-9 + / alphabet.
Non-ASCII characters Widened to UTF-8 bytes first. é -> C3 A9 -> w6k.
Output length Roughly 4/3 of the input byte length, rounded up to a multiple of 4. Padding = fills the last group.
URL-safe Off by default (standard alphabet + / =). On replaces + with -, / with _, drops trailing = padding (RFC 4648 base64url). Required for JWT tokens and most modern web APIs.
Wrap Lines Off by default (single line). On splits the output every Line Length characters with \n.
Line Length Default 76 (MIME). Range 4 to 998. Only takes effect when Wrap Lines is on.
Whitespace and line breaks Encoded as their literal byte values (0x20, 0x0A, 0x09). Not stripped.
Empty input Returns an empty string.

FAQ

Is base64 encryption?
No. Base64 is a reversible encoding. Anyone can paste the result into base64 decode and read the original. For a one-way digest, use SHA-256.
Why is the output longer than the input?
Base64 uses 6 bits per output character to represent 8-bit bytes, so output length is roughly 4/3 of input byte length. Padding rounds up to the next multiple of 4. Non-ASCII text grows further because each character becomes 2 to 4 UTF-8 bytes before encoding.
Does it handle accented characters and emoji?
Yes. The encoder widens to UTF-8 first via encodeURIComponent. café encodes the bytes C3 A9 for the é, and a single emoji like 🙂 encodes 4 UTF-8 bytes.
Should I turn on line wrapping?
Turn on Wrap Lines when the target format requires it. MIME headers and PEM blocks expect 76- and 64-character lines respectively. Leave it off for HTTP headers, JSON string values, JWTs, and data URIs, which expect a single unbroken token.
Is the output sent anywhere?
No. The encode runs entirely in your browser via the native btoa function. Nothing is uploaded, nothing is logged.