Skip to content
Toolars
Explore

Base64 Encoder / Decoder

Encode text as Base64 or decode it back.

Local processing

Processing details

Tool inputs are processed on your device.

Resources may be downloaded to run this tool. Account services are separate.

Preparing offline use…

Privacy information
Report bug

Task path / input to outcome

How to encode and decode Base64

  1. 01

    Pick Encode or Decode

    Use the mode tabs to choose a direction before you paste. The result pane updates live as you type, and the status dot reports Ready, Valid, or Error for the current input, so malformed values surface before you copy anything.

  2. 02

    Enter or paste the value

    Type into the Text input pane to encode, or paste into the Base64 input pane to decode; the panes relabel themselves with the selected mode. Load sample drops in a tiny example so you can see the round trip first, and whitespace inside a pasted Base64 value is ignored when decoding.

  3. 03

    Set the character and format options

    UTF-8 is on by default and is required for characters beyond the Latin-1 byte range, such as emoji and CJK text. URL-safe swaps + and / for - and _ and strips the padding so the value survives inside URLs and file names. Preserve line breaks, also on by default, keeps newlines instead of folding them into spaces, and every option applies to both directions.

  4. 04

    Check the live validation

    Decoding validates as you go. Characters outside the alphabet, an impossible length, and — with UTF-8 on — bytes that are not valid UTF-8 each produce a named error that tells you what to fix. Correct the flagged value and the result recovers immediately, with no run button to press.

  5. 05

    Round-trip with Swap

    Use Swap to move the output into the input with the direction flipped: a decode becomes an immediate re-encode, and a matching input proves the value survives the trip exactly. This is the fastest way to verify a credential or configuration value before it goes into a CI variable or an API call.

  6. 06

    Copy or download the result

    Copy result takes the output to the clipboard for a ticket or a terminal, and Download .txt saves it as toolars-base64.txt or toolars-decoded.txt. Clear empties the current workspace; it does not remove an output copy you explicitly handed to another tool. See the privacy FAQ for its retention.

Tool facts

Processing
In your browser
Input leaves this device
Never
Retention
Optional local handoff
Price
Free

Your input stays in the browser.

Base64 Encoder/Decoder uses its verified local execution path and does not create a hidden input or output history.

Local execution

Runs inside the current browser tab.

No hidden processing

Active tool data never becomes a Toolars document record.

No account required

Use the core workflow without creating a profile. Favorites sync to your account after you sign in.

Workspace and handoff

Closing the tab clears normal workspace data. If you choose a handoff, the selected result stays on this device across reloads and tab closes, and can be accepted for 30 minutes. Accepting or dismissing removes it; expired records are cleared the next time the handoff feature is used.

When Base64 Encoder/Decoder is useful

Encode a CI secret as one line

Turn a multiline credential into a single environment-variable line: keep UTF-8 on, switch Preserve line breaks off so newlines fold into spaces, encode, and press Swap once to confirm the decoded value matches the normalized single-line text.

Read a Base64 field from an API response

Paste the opaque value from the payload into the Base64 input pane and decode it in place. The named error messages separate a corrupted value from one that simply needs the URL-safe option turned on.

Prepare a token for a URL parameter

Enable URL-safe to replace + and / with - and _ and drop the padding, encode the token, and paste the result into the query string without any further escaping.

What Base64 Encoder/Decoder actually does

A deployment pipeline wants a private key folded into a single CI variable; a server response carries a Base64 field that nobody on the team can read by eye; an HTML sample embeds a data URL whose payload needs checking before reuse. A free Base64 encoder online should never ask you to trust a server with material like that. This Base64 encoder online runs entirely in the browser tab: the conversion happens as you type, malformed input is flagged with a named error instead of a garbled guess, and the Swap button turns any decode into an immediate re-encode so you can prove a value round-trips exactly. Reach for it when you need an HTTP Basic authorization header, a one-line secret for an environment variable, a URL-safe token for a query parameter, or a quick read of a payload field in an API response. Developers also use it to inspect JWT segments and to check data URLs in stylesheets. Because nothing is uploaded, tokens, private keys, and internal configuration stay on the device and disappear when the workspace is cleared.

Make the representation visible.

Plain textToolarsVG9vbGFycw==
UTF-8 textHello, 世界SGVsbG8sIOS4lueVjA==
Decode a valueSGVsbG8=Hello
Base64 changes representation.

It does not encrypt the original content.

Encoding is not encryption

A readable representation does not hide or secure the source.

Standards matter

Choose standard or URL-safe output for the target system.

Text has an encoding

UTF-8 turns characters into predictable bytes first.

Invalid input should fail

Clear errors are safer than silently changing malformed data.

Common questions

What is Base64 used for?
Base64 encodes arbitrary bytes as ASCII text so binary or non-Latin data can travel through systems that only handle plain text: HTTP Basic authorization headers, email attachments in MIME messages, data URLs, JWT segments, and configuration values stored as environment variables. It encodes — it does not compress or encrypt — so the output is roughly one third larger than the input.
Is Base64 encryption?
No. Base64 is an encoding, not a cipher: anyone holding the value can decode it without a key, so it must never be used to protect secrets at rest. Its job is transport safety, not confidentiality — use real encryption when the data itself must stay unreadable, and treat Base64 in a repository as plaintext.
Why do I get "Enable UTF-8 to encode characters outside the byte range"?
With UTF-8 off, encoding maps each character to a single byte, so only characters with codes up to 255 can be encoded. Emoji, CJK text, and most accented scripts need the UTF-8 option, which is enabled by default; turning it back on fixes the error.
What is URL-safe Base64?
A variant where + becomes - and / becomes _, with the trailing = padding removed, so the value survives inside URLs and file names. Enable the URL-safe option to produce it, and keep the same option on when decoding such a value — the decoder accepts unpadded input, so the round trip stays clean.
What does Preserve line breaks change?
When it is on, newlines are encoded and decoded as part of the text. When it is off, every line break is folded into a single space before encoding (and after decoding), which is what you want for values that must travel as one line, such as environment variables.
Why does my Base64 fail to decode?
ASCII whitespace between groups and omitted padding are accepted, so those are rarely the cause. The strict checks reject incorrect padding and nonzero unused bits in the final group, and with UTF-8 on they also reject byte sequences that do not form valid UTF-8 — often a sign the value used a different alphabet or was truncated in transit. Note that decoding exports text, never raw binary.
Can I encode a file or an image here?
This workspace converts text. For files, use the image-to-base64-converter tool, which turns uploads into data URLs or raw Base64 strings entirely in the browser. Byte mode in this workspace exports text, not raw binary, so do not use it to reconstruct executables or image files.
How do I confirm a value round-trips?
Use Swap: it moves the output into the input and flips the direction, so encoding followed by Swap re-decodes the value in one click. If the restored text matches the original — including newlines when Preserve line breaks is on — the value is safe to paste into its destination.
Is the text I paste uploaded anywhere?
Encoding and decoding run locally without an account or uploading your text. The current workspace uses memory; Clear empties both panes. If you explicitly hand output to another tool, that output is saved in local browser storage. Resetting, reloading or closing the workspace does not remove this pending copy. Receiving or dismissing the handoff deletes it; after 30 minutes it can no longer be received.

Keep reading

Related tasks, not a dead end.

Move into another focused workspace without returning to the full index.

URL Workbench

Clean URL lists with signed-link protection and per-line reasons. Compare components and export sitemaps.

Edit

JSON Explorer

Query JSONPath, extract fields and round-trip JSON Pointer records without losing large-number precision.

Inspect

JSON Schema Validator

Validate Draft 7 or 2020-12 locally with exact error paths; infer schemas from multiple observed samples.

Inspect

HTML Publishing

Clean pasted HTML for publishing while preserving lists, links and table semantics; preview changes safely.

Publish