Developer Tools

Base64 Encoder

This free Base64 Encoder converts typed or pasted text to standard Base64 as you type. Text is converted to UTF-8 first, so accented letters and emoji encode correctly, and everything runs in your browser with nothing uploaded.

Runs in your browser. Your files and text never leave your device - nothing is uploaded.

Encode Text to Base64 Online

The Tools Kit’s free Base64 Encoder converts any text into a Base64 string the moment you type it. Base64 represents data using only 64 printable ASCII characters, which lets it pass safely through JSON fields, HTTP headers, email bodies, environment variables and data URIs that might otherwise mangle special characters.

The encoder is UTF-8 safe: your text is turned into UTF-8 bytes first, so accented letters, non-Latin scripts and emoji all encode correctly as UTF-8. Everything runs in your browser, and nothing you type is uploaded. To reverse the process, paste the result into the Base64 decoder.

How to Use the Base64 Encoder

  1. 1

    Enter your text

    Type or paste the text you want to encode into the Plain Text Input box. Spaces and line breaks count as part of the input.

  2. 2

    Read the Base64 output

    The Base64 string appears in the Base64 Output panel as you type. There is no Encode button to press and no settings to choose.

  3. 3

    Copy the result

    Click Copy Base64 to put the encoded string on your clipboard, ready to paste into code, a config file or a header.

  4. 4

    Clear and start again

    Click Clear to empty the input box and encode something new.

The output is standard Base64 on a single line, with no line wrapping, so it can be pasted straight into code or a config file.

How Base64 Encoding Works

Base64 reads the input three bytes (24 bits) at a time and splits those bits into four groups of six. Each 6-bit value, from 0 to 63, is mapped to one character of the alphabet: A-Z for 0 to 25, a-z for 26 to 51, 0-9 for 52 to 61, then + and /. Take the word Man: its bytes are 77, 97 and 110, which regroup into the 6-bit values 19, 22, 5 and 46, giving TWFu.

When the input does not divide evenly into three bytes, the last group is padded with =. That is why the output length is always 4 × ceil(bytes ÷ 3) and the result is roughly a third larger than the original. If you want to see the raw bits behind each character, the binary converter shows the UTF-8 bytes of any text in binary.

Input textUTF-8 bytesBase64 output
Man3TWFu
Ma2TWE=
M1TQ==
Hello, World!13SGVsbG8sIFdvcmxkIQ==
café5Y2Fmw6k=
user:pass9dXNlcjpwYXNz

UTF-8, Emoji and the btoa Problem

The browser’s built-in btoa() function only accepts characters in the Latin-1 range, so calling it directly on text like 日本 or an emoji throws an error, and accented letters such as é are encoded as single Latin-1 bytes rather than UTF-8. This tool works around both problems by first converting the text to UTF-8 bytes and only then applying Base64. The letter é becomes two bytes, which is why café is four characters but five bytes, and an emoji usually takes four bytes.

If a paste cut an emoji in half, the leftover fragment cannot be converted to UTF-8, and the tool shows a short message asking you to retype the character rather than producing broken output. For text that needs a different kind of escaping, the HTML entity encoder turns characters like < and & into entities that are safe inside HTML markup.

Base64 vs URL-Safe Base64 and Other Encodings

This encoder outputs standard Base64, which uses + and /. Those two characters have special meanings in URLs, so the URL-safe variant, Base64url, replaces them with - and _ and usually drops the padding. JSON Web Tokens use Base64url for their header and payload, which you can inspect with the JWT decoder. If you need to put a standard Base64 string in a query parameter, run it through the URL encoder so the +, / and = characters are percent-encoded.

Base64 is also not the only text-safe encoding. Base32 uses a smaller, case-insensitive alphabet that suits one-time password secrets and file names, at the cost of longer output; you can try it with the Base32 encoder. And because Base64 hides nothing, data that must be verified rather than merely transported should be signed, for example with the HMAC generator, which produces a hex signature from a message and a secret key.

Common uses

  • Building an HTTP Basic Authorization header from a username:password pair
  • Embedding a value with quotes, line breaks or special characters in JSON, YAML or an environment variable
  • Creating a text data URI, such as data:text/plain;base64,... or an inline SVG
  • Preparing test fixtures and payloads for APIs that expect Base64 fields
  • Encoding a Kubernetes Secret value or similar config entry that must be stored as Base64

To encode a photo or other image rather than text, use the image to Base64 converter, which produces a complete data URI. For more formatters, encoders and converters, browse all developer tools.

Base64 terms explained

TermWhat it means here
Base64An encoding that represents any bytes using 64 printable ASCII characters, so binary or non-ASCII data can travel through text-only channels
AlphabetThe 64 characters used: A-Z, a-z, 0-9, plus (+) and slash (/), as defined in RFC 4648
Padding (=)One or two equals signs added at the end when the input length is not a multiple of 3 bytes, so the output is always a multiple of 4 characters
UTF-8The character encoding this tool applies to your text before Base64, so accented letters and emoji become well-defined bytes
Base64urlA URL-safe variant that swaps + and / for - and _ and often drops padding; this tool outputs standard Base64, not Base64url
Data URIA URL such as data:text/plain;base64,... that embeds content directly inside HTML, CSS or JSON

Frequently Asked Questions

Reviewed by Raja Jahangir · Last reviewed: October 7, 2026

What is Base64 encoding?

Base64 encoding converts binary data into 64 printable ASCII characters so it can travel safely through systems that expect text, such as email bodies, JSON fields, and data URLs. Base64 is an encoding, not encryption - anyone can decode it, so it protects nothing.

Sources and standards

Guides for Base64 Encoder