Base64 Encoder / Decoder

Convert UTF-8 text to Base64 and back, produce Base64URL for JWTs and URLs, or turn files and images into Data URLs ready to embed in HTML and CSS.

Text

Base64

SGVsbG8sIE5UIFRvb2xzIQ==

Use via API

Encodes UTF-8 text as Base64 or decodes Base64 (Data URLs accepted).

POSThttps://enhanced.dev.br/api/v1/encoding/base64
JSON body parameters
Body (JSON)TypeDescription
text *stringText to encode or Base64 to decode.
mode"encode" | "decode"Operation. Default: "encode".
urlSafebooleanOutputs unpadded Base64URL when encoding.

Request example

curl -X POST "https://enhanced.dev.br/api/v1/encoding/base64" \
    -H "Content-Type: application/json" \
    -d '{"text":"Olá, NT Tools!","mode":"encode"}'

Response

{
  "ok": true,
  "data": {
    "mode": "encode",
    "output": "T2zDoSwgTlQgVG9vbHMh"
  },
  "meta": {
    "version": "v1"
  }
}
  • Errors return { ok: false, error: { code, message } } with an HTTP 4xx/5xx status.
  • Free, no API key required. Limited to 120 requests per minute per IP.
  • CORS enabled: call it straight from the browser on any domain.

How to use

  1. Choose a source: Text or File / Image.
  2. In Text mode, pick Encode or Decode and type the content; the result updates in real time.
  3. Tick Base64URL to produce the URL-safe variant without padding.
  4. Use Swap to send the result back to the input and run the opposite operation.
  5. In File mode, select a file to get its Data URL and raw Base64, with a preview for images.

Use cases

  • Embedding icons and small images in CSS or HTML via data:image/...;base64.
  • Building HTTP Basic Auth headers (user:password in Base64).
  • Inspecting JWT segments, which use Base64URL.
  • Carrying binary data in JSON fields or environment variables that only accept text.

Technical concepts

How Base64 works

Base64 groups input bytes into blocks of 3 (24 bits) and splits them into 4 groups of 6 bits, each mapped to one of 64 characters: A–Z, a–z, 0–9, + and /. When the input is not a multiple of 3, the = sign pads the last block. The output is about 33% larger than the input.

Base64URL

Defined in RFC 4648 section 5, it replaces + with - and / with _ and usually drops the padding, so it can be used in URLs, file names and JWTs without extra escaping. The decoder on this page accepts both variants automatically.

UTF-8 and btoa

The browser's btoa function only accepts Latin-1 characters. For accents and emoji, the text is first converted to UTF-8 bytes with TextEncoder and then encoded; when decoding, the bytes are validated as strict UTF-8.

Frequently asked questions

Is Base64 encryption?

No. Base64 is a reversible encoding with no key. Anyone can decode it; never use it to protect passwords or sensitive data.

Why do I get a UTF-8 error when decoding?

The decoded content is binary (an image, PDF or archive) rather than text. The bytes are correct, but they cannot be displayed as text.

When should I use a Data URL for images?

For very small files, such as icons of a few KB, to save an HTTP request. For larger images, the 33% size increase and lack of caching make a separate file more efficient.

Related tools