---
title: "Base64 Encoder and Decoder | ToolSugar"
description: "Encode text or a file to Base64 and decode it back. UTF-8 safe, with a URL-safe option. Everything runs in your browser."
canonical: https://toolsugar.com/tools/base64-encoder
image: https://toolsugar.com/og.png
---

# Base64 Encoder and Decoder

This tool encodes text to Base64 and decodes Base64 back to text, and it can also turn any file into a Base64 string. Text is handled as UTF-8, so accents and emoji survive a round trip. A URL-safe option swaps in the dash and underscore characters. It runs in your browser with no upload.

Runs on your device

## How it works

1. Pick Text to Base64, Base64 to text, or File to Base64.
2. Type or paste your input, or choose a file.
3. Switch on the URL-safe alphabet if the result goes into a URL or a JWT.
4. Read the Result box and press Copy.

## Key facts

- **Text encoding**: UTF-8 in both directions
- **URL-safe mode**: Uses - and \_ instead of + and /, and drops the = padding
- **Decoding**: Accepts standard or URL-safe input, with or without padding
- **Files**: Read on your device and never uploaded; large files make a long string

## Common uses

- Embed a small image or font as a Base64 string in code.
- Decode a Base64 value from a config file or an API response.
- Prepare a URL-safe token or identifier for a query string.

## Questions

### Is Base64 a form of encryption?

No. Base64 is only a way to write bytes using 64 safe characters. Anyone can decode it, so never use it to hide secrets.

### Why does decoding sometimes say the bytes are not text?

The Base64 itself can be valid while the bytes inside are a binary file such as an image. This tool decodes to UTF-8 text, so it reports that case instead of showing garbled characters.

### What is URL-safe Base64?

It is the same encoding with - and \_ in place of + and /, usually without the = padding at the end, so the value can sit inside a URL or token without extra escaping.

[Read the Base64 Encoder and Decoder guide](https://toolsugar.com/blog/how-to-encode-and-decode-base64)

## Related tools

- [URL Encoder and Decoder](https://toolsugar.com/tools/url-encoder)
- [JWT Decoder](https://toolsugar.com/tools/jwt-decoder)
- [QR Code Generator](https://toolsugar.com/tools/qr-code-generator)
