Base64 encode a file without uploading it
Base64 turns bytes into text so they survive systems that only carry text. It is reversible by anyone with no key at all, so encoding protects nothing and adds roughly a third to the size.
At a glance
- Tool
- /tools/base64, with /tools/image-to-base64 for images as data URIs
- Input
- Text or a file
- Variants
- Standard and URL-safe alphabets
- Options
- Line wrapping
- Size change
- The encoded form is about a third larger
- Security value
- None. Decoding requires no key
In detail
The misconception is worth attacking directly, because it turns up in real systems: base64 is not encryption and not obfuscation. There is no key, no secret and no work involved in reversing it. A password stored base64 encoded is a stored password with an extra step, and a token that looks scrambled in a config file is a token in plain sight.
What it genuinely does is carry bytes through channels that only accept text. Embedding a small image directly inside a document or a stylesheet, putting a file into a JSON field, moving binary content through a system that would otherwise mangle it. Those are all sensible uses and none of them involve secrecy.
Pick the variant to match the consumer. The standard alphabet includes characters that are unsafe in a URL or a file name, so the URL-safe variant substitutes them; line wrapping exists because some older protocols require lines under a set length. A decoder expecting one alphabet will usually fail on the other, which is a common and confusing error.
Encoding a file is arithmetic, so it runs with the network off, which is worth doing once with something you would not want transmitted. It also makes the size point concrete: watch a file grow by roughly a third and you will think twice before embedding a large image in a document as a data URI.
Things that catch people out
- Encoding is not encryption. If the content needs to be secret, encrypt it, and encode the result afterwards only if a text-only channel demands it.
- The encoded form is about a third larger, so embedding a big image makes the containing document heavier than the image was.
- Standard and URL-safe alphabets are not interchangeable. A decoder expecting one will usually fail on the other.
- Line breaks inside an encoded string are ignored by some decoders and rejected by others. Match the wrapping to what the receiving system actually expects.
Try it: Hash Generator
The file hasher is on every page here because it takes any file at all and proves the point: disconnect from the network, drop a file in, and it still returns a checksum you can compare against a published one.
Hash Generator
LOCAL · Browser-OnlyGenerate MD5, SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-512, Keccak-256, CRC32, and HMAC hashes from text or files
MD5 is cryptographically broken and should not be used for security purposes. Use SHA-256 or SHA-512 instead.
Related Working without uploading
All working without uploading →Encrypt text in your browser without uploading it
AES encryption that runs locally, so the plaintext and the passphrase both stay put. What that protects, and what it cannot protect.
Hash a file without uploading it
Checksum a file in your browser with SHA-256 and eight other algorithms. A hash proves the bytes match; it keeps nothing secret.
View a file as a hex dump without uploading it
Inspect any file's raw bytes in your browser. If you cannot identify a file, uploading it to find out is the wrong first move.
Generate a password without a server seeing it
Create passwords in your browser. A password produced by a remote service is a password that existed on somebody else's machine first.
Generate a QR code without uploading what it encodes
Make a QR code in your browser. The payload never leaves, and the result points where you said rather than through somebody else.
Merge PDF files without uploading them
Combine PDFs on your own machine. What merging does to the metadata of every source document, and how to check nothing was sent.
Tools for this
- Base64 Encoder/Decoder Base64 encode and decode online - convert text to Base64 or decode Base64 strings instantly, free
- Image to Base64 Free online image to base64 - convert images to Base64 encoded strings for embedding in code
- Hash Generator Free online hash generator - generate MD5, SHA-1, SHA-256 hashes from any input text