How to encode text to Base64
- Type or paste your text in the input box.
- Press Encode. The Base64 result appears below and can be copied with one click.
- Tick URL-safe for tokens and URLs: it uses
-and_instead of+and/and drops the=padding. - Tick Wrap at 76 to break the output into lines, as required by MIME email and PEM files.
Why "UTF-8 safe" matters
The browser's built-in btoa() function only accepts characters in the Latin-1 range, so it throws an error on emoji and many accented letters, and other tools silently produce the wrong bytes. This encoder first converts your text to UTF-8, the encoding used by almost every API and file today, and then encodes those bytes. The result matches base64 on Linux and macOS, Python's base64.b64encode(s.encode()) and Node's Buffer.from(s).toString('base64').
Typical uses include HTTP Basic authentication headers (user:password encoded), embedding small configuration blobs in environment variables or Kubernetes secrets, and building data URIs. Remember that Base64 is not encryption: anyone can decode it.
Encoding happens entirely in your browser. Nothing you type is sent anywhere.
FAQ
How do I create a Basic auth header?
Encode username:password (with the colon) and send the result as Authorization: Basic
Why does my output end with = signs?
Base64 works in blocks of 3 bytes. When the input is not a multiple of 3, one or two = characters pad the last block. URL-safe mode removes them.
How do I encode a file instead of text?
Use the File → Base64 tab on the same tool, or the Image to Base64 page, which also creates data URIs.