DevToys Base64 Decoder: <Invalid Base64> on a Large String
DevToys shows <Invalid Base64> on a 250 KB string that other decoders accept? Find the cause, decode it in Terminal, or decode and format it in Bytepliers.
TroubleshootingUpdated 7 min read
On this page
You pasted about 250 KB of Base64 (a JSON document, say) into the DevToys Base64 decoder on a Mac and got this:
<Invalid Base64>Another decoder, such as an online one, handles the same string without complaint.
Why it happens
A GitHub issue for DevToys 2.0-preview.8 on macOS (installed with Homebrew) describes this exact case. The reporter had a roughly 250 KB Base64 string holding JSON, and the issue was still open when we last checked in November 2024. We haven't tested newer DevToys builds and we don't know the root cause, so the fixes below work whichever side is at fault.
Here are the usual reasons a strict decoder rejects a string that a forgiving one accepts, most common first.
- Line breaks or spaces inside the string. RFC 4648 notes that MIME wraps Base64 at 76 characters and PEM at 64. Logs, emails and certificate-style output often carry those breaks.
- Non-alphabet characters. The same RFC says implementations must reject data containing characters outside the alphabet unless the governing specification says otherwise. Other specifications, MIME for example, say to ignore such characters. A strict tool fails on one stray character. A lenient tool skips it.
- URL-safe Base64. MDN's Base64 glossary explains that the URL and filename safe variant omits padding and uses
-and_in place of+and/. A decoder that only knows the standard alphabet will call it invalid. - Missing
=padding. This often goes with the URL-safe variant. RFC 4648 says padding may be unused in some circumstances, but a decoder that insists on it will reject the string. - Wrapper text copied with the data. Examples are surrounding quotes, a trailing comma, or a
data:...;base64,prefix. - Size or a bug in the tool. A very large paste may behave differently from a small one. We can't confirm that here. If the string is clean and still fails, treat it as a DevToys bug (see the report section below).
Fix 1: check and clean the string
Look at the very start and end of the pasted text first. A large copy often picks up a stray quote, bracket or newline there.
| What's in the string | Where it comes from | Fix | Bytepliers Decode |
|---|---|---|---|
| Line breaks or spaces every 64 or 76 characters | Wrapped Base64 from email, PEM-style output or logs | Remove all whitespace | Handled |
- and _ instead of + and / | URL-safe Base64 (common in tokens) | Replace - with + and _ with / | Handled |
No = at the end | Padding was stripped | Add = until the length is a multiple of 4 | Handled |
| Quotes or a trailing comma around the string | Copied from JSON or source code | Delete them | Remove first |
data:...;base64, at the start | A data URI, not raw Base64 | Delete everything up to and including the comma | Remove first |
Fix 2: decode in Terminal
macOS includes a base64 command. This reads your clipboard, removes spaces, line breaks, tabs and double quotes, maps URL-safe characters to the standard alphabet, decodes, and writes the result to a file:
pbpaste | tr -d ' \r\n\t"' | tr '_-' '/+' | base64 -D > decoded.jsonThis overwrites decoded.json in the current folder if it already exists. To undo it, delete the file. The command does not add missing = padding, so if it reports an error, add the = characters yourself. Options on the built-in base64 differ between macOS versions, so run man base64 if -D isn't accepted.
Open decoded.json in any JSON viewer. More on the command is in how to encode and decode Base64 on Mac.
Fix 3: decode and format in Bytepliers
We make Bytepliers, so weigh this section accordingly. Its Base64 tool in Decode mode accepts both alphabets, whitespace and missing padding, so the cleanups above aren't needed. It's a native Mac app with 41 offline tools, and the decode runs live on your Mac.
- Copy the Base64 string.
- Open Bytepliers and press ⌘2 (Command-2) to open Base64.
- Switch the mode to Decode.
- Click Paste from Clipboard in the input header, or press ⌘V in the input pane.
- Press ⇧⌘C (Command-Shift-C) to copy the decoded output.
- Press ⌘1 to open JSON Formatter and paste the output into its input pane.
JSON Formatter shows "Valid JSON · N values" when the document parses. Its parsing menu is Lenient by default, which repairs comments, trailing commas, single quotes and similar problems and reports "Repaired N issues". Strict accepts RFC 8259 JSON only. For a big payload, the Text | Tree output tabs help you move around.
A 250 KB string is well inside the limits. Most text tools in Bytepliers refuse input over 2 MB with "Input is 3.1 MB — the limit for live conversion is 2 MB." JSON Formatter itself accepts up to 64 MB. If your Base64 is over 2 MB, decode it with the Terminal command above, then open the result with File ▸ Open… (⌘O).
Chain decode and format with a recipe
If you do this often, a Pipelines recipe does both steps at once.
- Open Pipelines from the Automate group in the sidebar.
- Choose Add Step ▸ Encode & Decode ▸ Base64 Decode.
- Choose Add Step ▸ JSON & Data ▸ Format JSON.
- Paste a sample into the input pane and check the output pane.
- Choose Save As… and name it, for example
Base64 JSON.
Now copy any Base64 string, press ⌘K and run Run “Base64 JSON” on Clipboard. Bytepliers replaces your clipboard with the formatted JSON and shows a HUD ("N steps · clipboard replaced"). Each step's input is capped at 2 MB, and a recipe stops at the first failing step with "Step N: …" in the output pane. See Pipelines and recipes.
Decode from any app with the Quick Panel
- Copy the string.
- Press ⌥⌘B (Option-Command-B), the default global shortcut.
- With Transform on Auto-detect, a Base64 string is decoded. If it picks something else, type
b64dto choose Base64 Decode, or type your recipe's name. - Press ⏎ to copy the result and close the panel.
The panel previews only the first 20 KB or 400 lines of a long result, but ⏎ copies everything. It won't transform a clipboard over 1,000,000 bytes. The panel's Format JSON uses the strict parser, so use the recipe or JSON Formatter when the JSON needs repair. Details are in Quick Panel, Instant Replace and the menu bar.
Checklist before you try again
- The string starts and ends with Base64 characters only (no quote, bracket or comma).
- No
data:prefix is left at the start. - It is under 2 MB if you use the live tools in Bytepliers.
- You know whether it is URL-safe (
-and_) or standard (+and/). - You copied the whole string. A truncated paste is a common cause when the clipboard comes from a terminal or a log viewer.
If decoding still fails or the output looks wrong
- The decoded output is unreadable. The payload may be gzip-compressed. In a recipe, use Base64 → Gunzip instead of Base64 Decode, then Format JSON.
- The string is a JWT. A JWT is three Base64URL segments separated by dots. Use JWT Decoder (⌘4).
- The string is an image data URI. Use the Base64 Image tool.
- The decoded JSON is wrapped in a string or has escaped quotes. Paste it into JSON Formatter. In Lenient mode it handles string-wrapped and backslash-escaped documents.
- Bytepliers opens the license window. Each app runs free for 7 days. After that, one MacSuite license ($349 one-time, as of November 2026) unlocks every MacSuite app. See pricing.
For other size limits and messages, see Troubleshooting Bytepliers.
If nothing works: report it to DevToys
DevToys is free and open source (MIT, as of November 2026) and fine for smaller strings. If a string that decodes elsewhere still fails, add your details to the existing report on the DevToys GitHub issue tracker (search for "Invalid Base64"). Include:
- Your DevToys version and how you installed it.
- Your macOS version.
- The approximate size of the string.
- Which other decoder handles the same string.
- The exact message:
<Invalid Base64>.
A short message you can adapt:
DevToys 2.0-preview.8 on macOS (installed with Homebrew) shows "<Invalid Base64>"
for a Base64 string of about 250 KB that contains JSON. The same string decodes
correctly in another decoder. macOS version: [your version]. The string has/has no
line breaks, and uses the standard/URL-safe alphabet. I can share a sample on request.If Bytepliers is what fails, use MacSuite support and include the exact error text, the approximate size of the string, and the steps above that you tried.
Common questions
Is the 250 KB size the problem in DevToys?
We can't say. The report ties the error to a large string but doesn't identify a cause, and we haven't tested newer builds. Cleaning the string and trying a smaller piece is the quickest way to tell size from content.
Does the Terminal command handle URL-safe Base64?
Yes, the second tr maps - and _ to + and /. It does not restore missing = padding, so add that yourself if base64 -D complains.
Why does one decoder accept the string and another reject it?
RFC 4648 lets a specification either reject characters outside the alphabet or ignore them, as MIME does. Different tools choose differently, so line breaks and missing padding are accepted by some and refused by others.
Can Bytepliers decode more than 2 MB?
Not live in the Base64 tool. Decode with the Terminal command, then open the file in JSON Formatter, which accepts up to 64 MB.