Docs

Base64 Encoder

Encode text to Base64 with URL-safe and line-wrap options.

Overview

Encodes a string to Base64. Supports URL-safe alphabet and PEM-style line wrapping.

Features

  • URL-safe alphabet.
  • PEM-style line wrap.
  • Configurable wrap width.

Use cases

  • Encoding a token for a URL.
  • Generating a Basic Auth header.

API reference

POST /api/v1/tools/base64

Encode a string to Base64 or decode Base64 back to text. Supports URL-safe (RFC 4648 §5) and PEM-style line-wrap on encode.

Returns: The encoded or decoded Base64 string, plus the byte count of the input.

Parameters

NameTypeRequiredDefaultDescription
action string (encode|decode) Yes — Whether to encode or decode.
input string Yes — The text to encode, or the Base64 string to decode.
urlSafe boolean No false Produce (or accept) the URL-safe alphabet with - and _ instead of + and /.
lineWrap boolean No false On encode, wrap output into lines of lineWrapWidth characters (PEM-style).
lineWrapWidth number No 76 Line width when lineWrap is true. Default 76 (RFC 1421).

Example

curl -X POST https://data-migration-tools.com/api/v1/tools/base64 \
  -H "Content-Type: application/json" \
  -d '{"action":"encode","input":"hello world","urlSafe":true}'

See the full API reference for all examples and error codes.