JSON Formatter & Validator
Free online JSON formatter, validator, and minifier: beautify messy JSON, fix errors, and minify code instantly. 100% private in-browser with zero uploads.
Free online Base64 encoder and decoder: encode and decode text or files to Base64 with UTF-8 support. 100% private in-browser with zero server uploads.
In modern computing, data must frequently travel across network boundaries, communication protocols, and storage media designed exclusively for printable plain text. Legacy email transmission protocols (SMTP), JSON payloads, XML feeds, and URL query strings were architected to handle human-readable ASCII characters rather than arbitrary binary bytes.
When raw binary data—such as cryptographic signatures, compiled byte arrays, compressed images, or multi-byte UTF-8 strings—is transmitted through 7-bit or text-oriented channels, control characters (like null bytes, line feeds, and carriage returns) can trigger silent truncation or data corruption. Base64 encoding solves this fundamental computer networking challenge by translating arbitrary binary bytes into an invariant, universally transportable alphabet of 64 printable characters.
At the hardware level, digital computers store information in 8-bit bytes (octets), representing \(2^8 = 256\) discrete values ranging from 0x00 to 0xFF. The Base64 encoding scheme (standardized under RFC 4648) selects 64 characters from the standard US-ASCII character set:
A–Z (representing decimal values 0–25)a–z (representing decimal values 26–51)0–9 (representing decimal values 52–61)+ (value 62) and Slash / (value 63)= (used when input bytes do not divide evenly by three)Because \(2^6 = 64\), each Base64 character conveys exactly 6 bits of information. To bridge the gap between 8-bit storage and 6-bit representation, the algorithm groups input bytes in triplets of three 8-bit bytes:
3 Bytes × 8 Bits = 24 Total Bits → 4 Characters × 6 Bits = 24 Total Bits
Example Step-by-Step Breakdown: Encoding the word "Man":
1. ASCII binary bytes: 'M' (01001101), 'a' (01100001), 'n' (01101110).
2. Concatenated into a continuous 24-bit stream: 010011010110000101101110.
3. Split into four 6-bit chunks: 010011 (19), 010110 (22), 000101 (5), 101110 (46).
4. Lookup in Base64 index table: 19 = 'T', 22 = 'W', 5 = 'F', 46 = 'u'.
Therefore, "Man" encodes into exactly "TWFu".
Because input strings or files do not always contain a byte count divisible by three, Base64 incorporates a deterministic padding mechanism:
"M"): The single 8-bit byte is padded with four zero bits to yield 12 bits. These 12 bits form two 6-bit Base64 characters. To maintain the 4-character block structure, two trailing equals signs (==) are appended (e.g., "TQ==")."Ma"): The 16 bits are padded with two zero bits to yield 18 bits, forming three 6-bit Base64 characters. One trailing equals sign (=) is appended (e.g., "TWE=").While standard Base64 functions reliably in HTTP headers and MIME attachments, its use of the plus sign (+) and slash (/) creates severe vulnerabilities when embedded directly into web URLs or URL query strings:
+): In URL query parameters, the plus sign is standard percent-encoding for a space character. When a web server parses ?token=a+b, it decodes the + into a space, permanently corrupting the Base64 token./): Slashes denote hierarchical path delimiters in URLs, causing URL routers or reverse proxies (Nginx, Cloudflare) to misinterpret token fragments as folder directories.To eliminate this risk, RFC 4648 §5 defines URL-Safe Base64:
Uses + and / with standard = padding. Ideal for MIME email attachments, PEM certificates (SSL/TLS), and HTTP Authorization: Basic headers.
Substitutes + with hyphen (-) and / with underscore (_), often omitting = padding. Mandatory for JSON Web Tokens (JWT), URL query arguments, and filenames.
A Data URI (standardized under RFC 2397) allows web developers to inline small images, vector graphics, audio clips, or fonts directly inside HTML markup or CSS stylesheets:
When to Use Data URIs:
Note on Performance: Because Base64 adds ~33.3% byte overhead and bypasses independent browser image caching, avoid inlining large photography or background images over 15–20 KB. Reserve Data URIs strictly for small icons, SVGs, and fonts.
A widespread cybersecurity misconception among junior engineers is treating Base64 as a method of encryption. Base64 provides zero confidentiality, privacy, or protection. It possesses no cryptographic keys, no mathematical work factors, and no entropy. Anyone who intercepts a Base64 string can decode it back to the original text in less than a microsecond.
For example, HTTP Basic Authentication sends credentials formatted as Authorization: Basic dXNlcjpwYXNz. While this string looks scrambled to casual human observers, decoding reveals user:pass instantly. For real security, authentication payloads must always be transmitted over an encrypted HTTPS (TLS) tunnel.
Furthermore, developers often paste sensitive API secrets, JWT tokens, and private configuration files into online conversion tools. Toolhast's zero-upload guarantee ensures that all encoding and decoding operations execute 100% inside your browser's local sandbox memory. No credentials, tokens, or files are ever sent to remote servers or logged to disk.
Choose your operating mode: Text Encode / Decode, File to Base64 Data URI, or Base64 to Reconstructed File.
Type or paste your text, credentials, or Base64 string into the input pane, or drag and drop a local file.
Toggle URL-Safe mode (RFC 4648 §5) if using the output in web URLs or JWTs, or enable 76-character MIME breaks.
Click 'Copy' to copy the encoded or decoded output, or click 'Save' to download the resulting file locally.
Encoded as a standard RFC 4648 string, ready for use in HTTP Authorization: Basic headers.
Converted into a self-contained Data URI for zero-request inline CSS background-image styling.
No. Base64 is a binary-to-text encoding algorithm designed to safely transmit arbitrary binary data across text-only protocols like HTTP, email, and JSON without corruption. It provides zero cryptographic security or obfuscation. Anyone can instantly decode Base64 back into its original plaintext without needing a secret key, password, or decryption algorithm.
Computers store binary data in 8-bit bytes (256 possible values). Because legacy communication channels only guarantee safe transmission of ASCII characters, Base64 splits data into 6-bit groups (64 values). Representing 24 bits requires four 6-bit Base64 characters instead of three 8-bit bytes, creating an inevitable 33.3% overhead in payload size.
Standard Base64 uses the plus sign (+) and slash (/) characters, which have special syntactic meanings in web URLs and query strings. URL-safe Base64 (defined in RFC 4648 section 5) replaces plus with hyphen (-) and slash with underscore (_), preventing URL parsing errors in JSON Web Tokens (JWT) and web parameters.
Convert your image into a Data URI and assign it directly to an HTML image tag's source attribute: `<img src="data:image/png;base64,iVBORw..." alt="Image" />`. This technique inlines the image data directly inside the HTML markup, eliminating an extra HTTP network round-trip for small UI icons, logos, and critical above-the-fold graphics.
The native browser functions `btoa` and `atob` were designed exclusively for 8-bit Latin-1 binary strings (code points 0 to 255). When passed multi-byte Unicode characters like emojis or non-Latin alphabets, they throw a `DOMException`. Toolhast uses the modern `TextEncoder` and `TextDecoder` APIs to ensure crash-free, full UTF-8 encoding across all languages.
No. Toolhast performs all Base64 encoding, decoding, file reading, and Data URI conversions directly inside your web browser via client-side JavaScript. No text, API tokens, Basic Auth credentials, personal images, or confidential documents are ever transmitted across the internet or stored on external servers, providing complete data privacy.
Free online JSON formatter, validator, and minifier: beautify messy JSON, fix errors, and minify code instantly. 100% private in-browser with zero uploads.
Free online URL encoder and decoder: encode and decode URLs and URI query parameters with UTF-8 percent-encoding. 100% private in-browser with zero uploads.
Free online UUID and GUID generator: generate random RFC 4122 version 4 UUIDs instantly in bulk or single. 100% private in-browser with zero tracking.
Private: this tool runs in your browser. Nothing you type is uploaded.
Last updated