Example: the tool is already working on a sample input. Replace it with your own and press the button.

SGVsbG8sIEdlbmVyYXRlUGx1cyE=

Characters: 28

Encode text to base64

Type or paste text and press encode. The text is encoded as UTF-8, and line breaks as LF (\n), the way a Unix shell would encode them. Tick URL safe for base64url (RFC 4648, section 5), and untick padding to leave out the trailing =, as JSON Web Tokens and many URL parameters do.

Base64 encoding in short

Base64 turns bytes into text that passes through any system that only handles printable ASCII: e-mail bodies, JSON strings, HTML attributes, HTTP headers. Every 3 bytes become 4 characters, so the encoded text is about 33 percent longer than the input. If the input length is not a multiple of three, one or two = pad the result to a multiple of four characters.

Examples

  • Hello becomes SGVsbG8=.
  • user:pass becomes dXNlcjpwYXNz – the form HTTP Basic authentication sends as Authorization: Basic dXNlcjpwYXNz.
  • <<???>> becomes PDw/Pz8+Pg== in the standard alphabet and PDw_Pz8-Pg URL-safe without padding.

Standard or URL-safe?

The standard alphabet uses + and /, which have a meaning of their own in URLs and file names. Base64url replaces them with - and _ and usually leaves out the padding. Use it for values in URLs, for file names and for JSON Web Tokens; use the standard alphabet for MIME, data URIs and most APIs.

Encoding is not encryption

Anyone can decode base64; it hides nothing. To read an encoded value, use the base64 decoder. If you need random keys rather than your own text, the base64 generator creates them from secure random bytes.

Base64, URL and JWT tools

Frequently asked questions

Which character encoding is used for the text?
UTF-8. Line breaks are encoded as LF, the way a Unix shell encodes them, so the result matches what printf and base64 produce on Linux or macOS.
What is the difference between base64 and base64url?
Base64url uses - and _ instead of + and /, so the result can go into a URL or a file name unchanged. JSON Web Tokens use base64url without padding.
Do I need the = padding?
It depends on the receiving side. MIME and most libraries expect it; JWTs and many URL parameters leave it out. A decoder that knows the length can do without it.