Get started
HomeEncoding & SecurityBase64 Encode
Encoding & SecurityRuns in your browser · files never uploaded

Base64 Encode

Encode text to Base64

4.6· 44 votes
Base64 encoding converts arbitrary bytes into a 64-character ASCII alphabet, letting you safely embed binary data inside text formats like HTML, CSS, JSON, or URLs. StuHub encodes UTF-8 text, raw bytes, and files entirely in your browser — the input never leaves your device.
Your file never leaves this browser. Everything runs on your device — no uploads, no server storage, no retention.How it works →
Padded with `=`. Alphabet: A–Z a–z 0–9 + /
Plain text29 chars
Base6448 chars
SGVsbG8sIPCfjI0hIENhZsOpIG5hw692ZSBmYcOnYWRlLg==
Uses UTF-8 for encoding — Unicode and emoji round-trip cleanly.

What is Base64 Encode?

Encode any UTF-8 text to Base64, with standard or URL-safe alphabet options. The standard alphabet uses + and / with = padding; URL-safe uses - and _ and drops padding, so the output is safe inside a URL path or query string without percent-encoding. Handles Unicode and emoji correctly — no surprising mojibake when round-tripping non-ASCII text.

How do I use Base64 Encode?

  1. Paste text into the input panel.
  2. Choose Standard or URL-safe.
  3. Copy the encoded output.

Base64 Encode by the numbers

Alphabets
Standard + URL-safe
Padding
Configurable (on / off)
Input types
Text, file upload, raw bytes
Max file
100 MB
Character encoding
UTF-8 (default), ASCII

Common use cases for Base64 Encode

  • Embedding a small PNG icon directly in a CSS data-URI.
  • Encoding a JWT payload for a manual test request.
  • Preparing a certificate blob to paste into Kubernetes secrets.
  • Including binary bytes inside a JSON API payload.
  • Producing URL-safe tokens from random bytes.

Common pitfalls and how to avoid them

  • URL breaks because of + or /Toggle "URL-safe" output. It swaps + for - and / for _ and drops padding.
  • Emoji and accents get garbledEnsure UTF-8 encoding is enabled — non-ASCII characters must be UTF-8 encoded before base64.
  • Output is longer than the inputNormal — base64 adds ~33% overhead. If size matters, gzip first, then base64.

When should I use Base64 Encode?

Base64 Encode is for short strings and credentials. To decode Base64 back to text, use Base64 Decode. For encoding an image file as a data URI, use Image to Base64, which handles binary input directly.

Frequently asked
What is base64 encoding?

A binary-to-text encoding that represents any bytes using 64 safe ASCII characters. Used for embedding images in HTML, encoding binary data in JSON, email attachments, and API payloads.

Does it support UTF-8 text?

Yes. Non-ASCII characters (emoji, CJK, accents) are encoded as UTF-8 bytes first, then base64 — round-trips perfectly.

URL-safe or standard base64?

Toggle "URL-safe" to use - and _ instead of + and /, and to strip padding = characters. Required for JWT and URL parameters.

Is my file uploaded anywhere?

No. Everything runs in your browser. Your files never leave your device, and there is no server component for this tool.

Related in Encoding & Security
Base64 Decode
URL Encode
URL Decode
JWT Decoder
Hash Generator
Password Generator
Strength Checker
HMAC Generator