Security

Base64URL Encoder

Encode text into URL-safe Base64 using the Base64URL character set used by JWTs and other web-safe formats.

Last reviewed: April 30, 2026Free toolMethodology

Base64URL Encoder

These fields start with sample inputs. Keep them or replace them, then run the tool to show a fresh result.

Output

Calculating the sample result.

Why it matters

Base64URL avoids the `+`, `/`, and padding characters that can be awkward inside URLs and tokens.

When to use

  • Preparing JWT-style segments
  • Building URL-safe opaque values
  • Testing systems that expect unpadded Base64URL input

Inputs & Outputs

Inputs

  • Input text is the raw string you want to encode.

Outputs

  • Base64URL output shows the URL-safe encoded string.
  • Length summary helps compare the transformed output with the source input.

Base64URL encoding method

The tool performs standard Base64 encoding and then swaps reserved characters for URL-safe alternatives while removing padding.

Base64URL = Base64 with `+` → `-`, `/` → `_`, and optional padding removed

Worked example

1

JWT segment prep

A developer wants to encode a JSON payload into URL-safe Base64 for a token test.

Inputs

  • Input text: {"sub":"123","scope":"demo"}

Steps

  • Encode to Base64
  • Swap reserved characters
  • Remove padding

Result

  • The output is ready for URL-safe use.

Edge cases & caveats

  • Base64URL is a representation format, not a security layer.
  • Some systems expect padding while others do not, so confirm the target format.

Frequently Asked Questions

Why not use normal Base64?

Because standard Base64 includes characters that can cause problems in URLs and token formats.

Is this the same encoding used inside JWTs?

Yes. JWT header and payload segments use Base64URL encoding.

Keep going