How to use Text to Base64
- 1. Type text. UTF-8 including emoji and non-Latin scripts.
- 2. Copy Base64. Toggle URL-safe for JWT-style alphabet.
- 3. Decode anytime. Flip to Decode to reverse a string.
About this tool
String encode searches (“base 64 encode string”, “encoding example”) are the classic Hello→SGVsbG8= workflow. This page emphasizes Text encode with JS/Python examples nearby.
JavaScript example
Prefer `TextEncoder` + Base64 over raw `btoa` for Unicode. This studio uses UTF-8 bytes so emoji does not throw.
Python example
`base64.b64encode('hello'.encode()).decode()` → `aGVsbG8=`.
Code examples
Node
Buffer.from("hello").toString("base64");
Buffer.from(b64, "base64").toString("utf8");Browser (UTF-8 safe)
btoa(unescape(encodeURIComponent(text)));
decodeURIComponent(escape(atob(b64)));Python
import base64
base64.b64encode(b"hello").decode() # aGVsbG8=
base64.b64decode("aGVsbG8=").decode()Data URI
const uri = `data:image/png;base64,${b64}`;
// <img src={uri} /> or CSS url('${uri}')