mockstack.

Base64 and URL Encoder

ENCODE · DECODE ← Developer & Data

Base64, URLs, HTML entities, and JSON strings, with correct Unicode handling.

Input
Output
LIVE · CONVERTS AS YOU TYPE RUNS LOCALLY

About the Base64 and URL Encoder

Encodes and decodes base64, URLs, HTML entities, and JSON strings, in your browser. Pick the encoding and direction in the rail; type or paste on the left, and read, copy, or download the result on the right.

Every Setting

Encoding
Base64 turns text or any file into plain characters and back. URL percent-encodes text so it can travel in a web address. HTML Entities escapes text so a page shows it instead of reading it as markup. JSON String escapes text so it fits inside quotes in JSON.
Direction
Encode or Decode. Paste something that already looks encoded while encoding, and a one-click switch offers to decode it instead.
Each Line Separately
Treats every line as its own value, for a list of tokens, links, or names. Without it the whole box is one value, line breaks included.
Variant
Base64 only. Standard is the common form. URL Safe swaps the two characters that break inside web addresses (+ and /) for - and _, which is what tokens and links expect.
Padding
The trailing = signs that square the output length. Some systems demand them, some reject them; the toggle writes both forms.
Wrap at 76
Breaks the output into 76-character lines, the format email attachments and some configs expect.
Encode a File
Reads the file’s real bytes, so accents, emoji, and binary data survive the round trip exactly. You can also drop a file on the card.
Output As
Base64 alone, a Data URI with the file’s type, or for images a ready CSS background-image line or an HTML img tag with the width and height filled in.
Component or Whole URL
Component encodes every character with a meaning in a URL, right for a single query value or path segment. Whole URL leaves : / ? # & and = alone, so a full address stays a working address. Spaces as + writes spaces the way HTML forms send them, and reads + back as a space when decoding.
Markup Characters or Also Non-ASCII
Markup Characters escapes only what HTML would misread. Also Non-ASCII turns accents and emoji into numbered entities as well, for systems that only take plain ASCII.
Wrap in Quotes
Adds the surrounding double quotes to an escaped JSON string, ready to paste as a value.
Input
Swap moves the output back into the input for chained conversions; Clear resets the page.
Output
Copy puts the result on the clipboard. Download writes decoded bytes to a file with the right extension, told from its contents; decoded images preview under the box.
Pane Divider
Drag the bar between the panes to deal the width; it remembers your split, and double-clicking resets it.
Cheat Sheet
Data-URI prefixes to insert, plus what the padding signs and the URL-safe characters mean.

Common Questions

Is base64 encryption?
No. It is a reversible encoding anyone can decode. Never treat it as protection.
Why is base64 bigger than the original?
The format spends four characters per three bytes, about a third larger by design.
How do I turn an image into base64 for CSS?
Choose Encode a File, pick the image, and set Output As to CSS. The result is a background-image line you can paste into a stylesheet.
Should I use Component or Whole URL?
Component for one piece, like a search term going into ?q=. Whole URL for an entire address that has spaces or accents in it.

Related: JWT Decoder, Hash Generator, JSON Formatter.