Base64 Encoder/Decoder

Convert text to Base64 and decode Base64 strings quickly.

// about

About this Tool

Base64 turns normal letters, numbers, or symbols into a special scrambled text format. This tool lets you convert text into Base64 or turn scrambled Base64 back into normal text.

How to use it

  1. Type or paste your text into the box.
  2. Select 'Encode' to scramble or 'Decode' to unscramble.
  3. Click 'Run' and copy the converted result.

Why people use this tool

  • Helps send text safely through systems that might misread special characters.
  • Quickly decode mystery Base64 strings you find in web links or code.
  • Simple two-way converter with no complicated settings.

Frequently Asked Questions

Is Base64 a secret password encryption?

No! Base64 is just a formatting style to prevent text errors, not a secure way to hide secrets.

Why does Base64 text often end with '=' or '=='?

Those equal signs are padding characters used to make sure the data length matches what computers expect.

Can I convert non-English text like Korean or Japanese?

Yes, our converter safely handles all international characters and emojis.

Guides · Encoding · 9 min read

Base64 Encoding Explained: How It Works, Where It Is Used and Common Myths

Email attachments, image data URIs and JWT tokens all rely on Base64. This guide explains exactly what Base64 does, why the output is longer than the input, and when you should and should not use it.

All computer data is ultimately bytes. Yet many channels can only carry text safely: email bodies, HTTP headers, JSON documents and URLs. If you push raw image bytes or ciphertext through those channels, control characters and line breaks can corrupt the data, or an intermediate system may rewrite it.

Man   → TWFu
Hi    → SGk=
한    → 7ZWc
안녕  → 7JWI64WV
Learn how Base64 turns 3 bytes into 4 characters, what the trailing = means, how Base64URL differs, and why Base64 is not encryption.
Read guide →
Build it with AI

Build this tool yourself with AI

Want your own version of this tool? Copy the work-order prompt into an AI chat, or save the skill file for an AI coding agent. Both describe the features, edge cases and test cases we used when building it.

AI work-order prompt

Paste it as-is into an AI chat such as Claude, ChatGPT or Gemini.

You are an experienced full-stack web developer. Build a web tool called "Base64 Encoder/Decoder" that meets the requirements below.

## Goal

Build a two-way converter that encodes text to Base64 and decodes Base64 back to text.

## Core features

- Switch between encode and decode
- UTF-8 handling so non-English text and emoji work
- Choose standard Base64 or Base64URL (-, _)
- Option to keep or omit padding (=)
- Copy-to-clipboard button for the result

## Inputs

- Text or a Base64 string
- Mode (encode/decode), variant (standard/URL), padding on/off

## Outputs

- Converted string
- Byte length of input and output

## Edge cases and handling rules

- Strip spaces and line breaks before decoding
- Restore missing padding so the length is a multiple of 4
- Show an error with the position of any non-Base64 character
- Warn when decoded bytes are not valid UTF-8

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- 'Man' → 'TWFu' and 'Hi' → 'SGk='
- '한' → '7ZWc' and decodes back to '한'
- Bytes FB FF give '+/8=' in standard and '-_8=' in URL variant

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

Skill (SKILL.md)

Save it as .claude/skills/build-base64-tool/SKILL.md for AI coding agents such as Claude Code to reuse whenever you build or change this tool.

---
name: build-base64-tool
description: Use when building or changing a Base64 Encoder/Decoder tool. Build a two-way converter that encodes text to Base64 and decodes Base64 back to text.
---

# Build: Base64 Encoder/Decoder

## Goal

Build a two-way converter that encodes text to Base64 and decodes Base64 back to text.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Switch between encode and decode
- UTF-8 handling so non-English text and emoji work
- Choose standard Base64 or Base64URL (-, _)
- Option to keep or omit padding (=)
- Copy-to-clipboard button for the result

## Inputs

- Text or a Base64 string
- Mode (encode/decode), variant (standard/URL), padding on/off

## Outputs

- Converted string
- Byte length of input and output

## Rules

- Strip spaces and line breaks before decoding
- Restore missing padding so the length is a multiple of 4
- Show an error with the position of any non-Base64 character
- Warn when decoded bytes are not valid UTF-8
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] 'Man' → 'TWFu' and 'Hi' → 'SGk='
- [ ] '한' → '7ZWc' and decodes back to '한'
- [ ] Bytes FB FF give '+/8=' in standard and '-_8=' in URL variant

Tips for working with AI

  • Tell the AI your stack (for example React, Vue or plain HTML) on the first line so the code matches your project.
  • Ask it to run the listed test cases and show the results before you accept the code.
  • Never paste real secrets, customer data or API keys into the prompt; use sample values instead.