Sign up free

Base64 Encode and Decode

Turn text or a file into Base64 and back, with UTF-8, URL-safe output and file downloads.

About Base64 Encode and Decode

Base64 encode text when a system only accepts plain ASCII, or decode the Base64 you find in one: an API header, a JSON field that has to carry a small file, a basic-auth string, or a config value with special characters. Paste the text and the Base64 appears as you type. Switch to Decode to turn Base64 back into readable text.

Text is encoded as UTF-8, so Chinese, accents and emoji come back intact. Tick URL-safe for the variant with - and _ and no padding, used in JWTs and URLs. Decoding accepts line breaks, data URIs and missing padding. If the result is a file rather than text, such as a PDF or an image, you get its size and a Save the file button. Encode a file turns any file into a data URL.

How to use Base64 Encode and Decode

  1. 1
    Choose Encode or Decode

    Pick the direction, and tick URL-safe if the Base64 is for a URL or a token.

  2. 2
    Add text or a file

    Type or paste into Input, or click Encode a file to turn a file into a data URL.

  3. 3
    Copy or save

    Copy the Base64 encode or decode result, or download decoded files with Save the file.

Why use Cubfile for this

  • UTF-8 safe

    Any language and emoji survive the round trip.

  • URL-safe variant

    Uses - and _ instead of + and / and drops the = padding.

  • Decodes to files

    Binary results are offered as a download, with the extension taken from a data URI.

  • Tolerant decoding

    Line breaks, spaces, data URI prefixes and missing padding are handled for you.

FAQ

Base64 Encode and Decode: questions and answers

Why does my Base64 decode show a Save the file button instead of text?
The data isn't text but a binary file, such as an image or a PDF. Click Save the file to download it, and if you pasted a data URI, the matching extension is used.
How do I Base64 encode a file?
Click Encode a file and choose it. The result is a data URL, the Base64 text prefixed with the file type. For raw Base64, delete everything up to and including the comma.
What is URL-safe Base64 encoding?
A variant that replaces + and / with - and _ and drops the = padding, so the text can sit in a URL or a JWT without escaping. Standard Base64 in a URL needs its +, / and = escaped, which URL Encode and Decode does.
Is Base64 encryption, or can anyone decode it?
No. Anyone can decode it, so don't use it to hide passwords. For real protection, use Encrypt File.
Is my data uploaded when I encode or decode Base64?
No. Encoding and decoding happen in your browser, so tokens and files stay on your device, with no daily limit.
Share Base64 Encode and Decode with a friendIt runs in any browser, and they can try it without signing up.

Related tools

JSON JSON FormatterFormat, validate and minify JSON, errors pointed out by line.
TXT Text CleanerRemove extra spaces, empty lines and broken line breaks in one click.
TXT Text CompareCompare two texts side by side and see every change.
TXT Word CounterCount words, characters, Chinese characters, lines and reading time live.
AaTXT Case ConverterUPPER, lower, Title, Sentence, camelCase, snake_case and more.
TXT Find and Replace TextReplace words in text in bulk, with regular expressions if you need them.
TXT Password GeneratorMake strong random passwords on your device.
TXT Remove Duplicate LinesDelete repeated lines and sort what’s left.