Text to Base64 Converter
Type or paste any text and get a Base64-encoded string, right in your browser — nothing is uploaded to a server. Pro Mode adds URL-safe encoding, line wrapping, splitting into multiple files, a data URI prefix, and a real Base64-to-text decode mode.
✓ Split into multiple files · ✓ Decode Base64 back to text
data:text/plain;base64, — paste straight into an href or src--- between partsHow to Use the Text to Base64 Converter
From typed or pasted text to a Base64-encoded string in seconds. No signup, and your text never leaves your browser.
Everything above runs entirely in your browser. The text you type, paste, or upload is never sent to a server, so its contents stay completely private from start to finish.
Text to Base64 Converter: Encode Plain Text Into Base64, and Decode It Back
Quick answer: Type or paste your text above, or upload a .txt file, and this tool encodes it into a real Base64 string, free and entirely in your browser. Pro Mode adds URL-safe encoding, a data URI prefix, line wrapping, splitting one block of text into multiple files, and a genuine Decode Mode that turns Base64 back into plain text.
Base64 is a way of representing arbitrary bytes, letters, numbers, punctuation, emoji, anything, using only 64 printable characters: A through Z, a through z, 0 through 9, plus two more symbols and an = padding character. It exists because a lot of systems, old email protocols, JSON fields, URL query strings, config files, were only ever designed to safely carry plain, printable ASCII text, not arbitrary binary data or certain punctuation. Converting text to Base64 turns it into a string that will survive being copied, pasted, emailed, or embedded somewhere without any character in it being misread, stripped, or corrupted along the way.
This tool's natural starting point is the text box itself: you type or paste directly into it, and a live counter tracks characters and words as you go. Uploading a .txt file is available as a convenience, checked by its actual decoded bytes rather than just its file extension, but pasting straight into the box is the primary, fastest path for most of what people convert here. Every option below, encoding or decoding, runs entirely as JavaScript in your own browser tab; nothing you type is ever sent anywhere.
1How This Text to Base64 Converter Works
Once you click Convert to Base64, the tool first encodes your text as raw UTF-8 bytes using the browser's built-in TextEncoder, the same correct, standards-based approach used internally by web browsers and virtually every modern programming language, so accented letters, East Asian text, emoji, and other multi-byte Unicode characters are handled properly rather than mangled. Those bytes are then grouped three at a time and mapped onto the 64-character Base64 alphabet defined in RFC 4648, the official internet standard for Base64 encoding, with = padding added at the end if the final group doesn't divide evenly by three. The result is a genuine Base64 string built directly in your browser, ready to copy, download, or drop straight into wherever it needs to go.
2Simple vs Pro Mode
| Feature | Simple | Pro |
|---|---|---|
| Encode typed or pasted text into Base64 | ✓ | ✓ |
| Upload a .txt file to load text into the box | ✓ | ✓ |
| Live character & word counter | ✓ | ✓ |
| Decode Mode — turn Base64 back into real text | — | ✓ |
URL-safe encoding (-/_, no padding) | — | ✓ |
Data URI prefix (data:text/plain;base64,) | — | ✓ |
| Line wrapping — 64 or 76 characters per line | — | ✓ |
| Split one block of text into multiple outputs, download as ZIP | — | ✓ |
Simple Mode covers the everyday case: paste in text and get back a single, unwrapped, standard Base64 string, no decisions required. Pro Mode, currently free to use, hands over the full toolkit that a developer or power user actually reaches for: a real decoder, URL-safe output, a ready-to-embed data URI, line wrapping, and splitting a long paste into several separate results.
3Decode Mode: A Real Base64-to-Text Decoder, Not Just an Encoder
A tool that only encodes text is only solving half the problem, since Base64 only becomes useful once something on the other end can turn it back into the original text. Turning on Decode Mode in Pro Mode repurposes the same input box: instead of typed text, it now expects Base64, and clicking Decode to Text runs the encoding process in reverse. The decoder is built to be genuinely robust rather than fragile: it automatically strips a data:...;base64, prefix if one is present, ignores line breaks and whitespace from wrapped or multi-line input, auto-detects and normalizes both the standard and URL-safe alphabets so you never have to tell it which one you used, and re-adds any missing = padding before decoding. If what's pasted in genuinely isn't valid Base64, or the decoded bytes don't form valid UTF-8 text, the tool shows a specific, honest error rather than silently producing garbage or a blank result, and when Splitting is also on, each ----separated part is decoded and reported on independently, so one bad part never blocks the good ones.
4URL-Safe Encoding and the Data URI Prefix: Two Genuinely Different Output Formats
Two Pro options exist specifically to change what the output string is actually made of, not just how it looks. URL-safe encoding replaces the standard alphabet's + and / characters with - and _, and drops the trailing = padding entirely, exactly as defined by RFC 4648's own Base64URL variant. That matters because a standard Base64 string containing a raw + or / can be silently corrupted or misinterpreted the moment it's dropped into a URL path, a query string parameter, or a filename, so URL-safe output is the version meant for exactly those contexts. The data URI prefix option does something different: it prepends the literal string data:text/plain;base64, to the front of the encoded output, matching the real RFC 2397 data URI scheme that browsers already understand natively. The result can be pasted directly into an HTML href or src attribute, or a CSS url() value, and used immediately as a self-contained, embeddable resource with no separate assembly step. Because a data URI is meant to be used as a single unbroken value, turning it on automatically overrides line wrapping for that output, keeping the string valid and usable exactly as generated.
5Common Reasons People Convert Text to Base64
Base64 shows up anywhere a system needs to guarantee that a piece of text will survive intact through a channel that wasn't built to carry every possible character safely, an authentication header, a URL, an older text-only email format, or a JSON config file that shouldn't contain raw special characters. Decoding is just as common a need in practice: pulling apart an API token to see what's really inside it, checking a value pasted from documentation, or confirming that an encoded string in a log file matches what you expect, which is exactly what this tool's Decode Mode is built for.
6Line Wrapping and Splitting One Block of Text Into Several Files
Two remaining Pro options give you control over the shape of the output rather than its content. Line wrapping breaks a long Base64 string into fixed-width lines, either 76 characters, the classic width used by MIME email encoding, or 64 characters, another common convention, instead of one continuous unbroken line; this is purely cosmetic and doesn't change the decoded value at all, wrapped or unwrapped Base64 decodes to exactly the same text once whitespace is stripped, which this tool's own decoder does automatically. Splitting works on the input side instead: placing a line containing only three dashes (---) between sections of your original text tells the converter to treat each section as an independent block, encoding every one separately, up to 20 at once, each downloadable on its own or all together as a single ZIP file. The same --- convention works in reverse in Decode Mode, letting you decode several separate Base64 blocks back into their original text in one pass.
Every word you type, paste, or load from a .txt file, in either direction, encoding or decoding, is processed entirely inside your own browser tab using JavaScript running on your device. Nothing is uploaded, stored, or transmitted to a server at any point, whether you're in Simple Mode or Pro Mode.
7Frequently Asked Questions
Built on open standards. The Base64 alphabet, padding rules, and the URL-safe variant this tool implements follow RFC 4648, "The Base16, Base32, and Base64 Data Encodings", the official IETF standard first published in 2006. The optional data URI prefix follows RFC 2397, "The data URL scheme", the standard that defines how browsers interpret a data: URI directly in markup.
More Text Converter Tools
Every other tool in the Text Converter category