LocalExcelTool
Get started

Text Encrypt / Decrypt

Encrypt and decrypt text with a key, entirely in your browser.

Runs in your browserNo account neededFree

What is Text Encrypt / Decrypt

Text encryption converts readable text into an unreadable form using a key. This tool uses a lightweight reversible XOR + Base64 scheme, so the same key restores the original text.

🔒 Everything runs in your browser. Nothing is uploaded.

What this tool actually does with your file

Where it runs
In your browser, on this page
Upload
None — the file never leaves your device
Offline
Works with the network disconnected

What this actually computes, stated plainly

The text is converted to UTF-8 bytes and XORed with the key bytes, repeating the key as needed; the result is Base64-encoded. Decryption reverses it. It is a stream cipher in shape, but with the key used directly and reused, so it is obfuscation rather than encryption.

That distinction matters because XOR with a repeated key is breakable. If any part of the plaintext is known or guessable — a header, a common word, a fixed prefix — the corresponding key bytes fall out immediately, and from a short key the rest of the message follows. Reusing the same key on two messages makes it worse.

When it is the right tool anyway

Hiding a value from a casual reader: a spoiler in a shared document, a puzzle answer, a joke in a chat, a field that should not be readable at a glance. For those, a short shared key and a reversible transform is exactly what is wanted, and a real encryption library would be overkill.

It is the wrong tool for passwords, API keys, personal data, or anything that would be costly if read. Those need AES-GCM through Web Crypto, with a key derived from a passphrase by PBKDF2 or Argon2 and a random IV per message. The difference is that AES-GCM is authenticated: tampering is detected rather than silently producing garbage.

Why a wrong key sometimes "works"

Decryption XORs back and then decodes as strict UTF-8. A wrong key usually produces invalid sequences and this page reports a failure — but about one guess in several dozen can produce bytes that happen to be valid UTF-8, yielding mojibake instead of an error. If the output looks like text but is nonsense, the key was wrong, not the message.

The ciphertext is Base64, so any transport that mangles Base64 — a URL query string treating + as a space, a chat app wrapping long lines — will corrupt it before decryption is even attempted. That failure is indistinguishable from a wrong key, so check the ciphertext length against the original before assuming the key is at fault.

How to use it

  1. 1.Enter text and a key
  2. 2.Choose encrypt or decrypt
  3. 3.Copy the result

How Text Encrypt / Decrypt works under the hood

Text tools look trivial until encoding enters the picture. The bytes are unambiguous; the characters they represent are a guess unless the encoding is declared.

  1. 1

    Read bytes, not characters

    The file is read as an ArrayBuffer so the original bytes are preserved, including a byte-order mark if present.

  2. 2

    Decode with a declared or detected encoding

    TextDecoder converts bytes to text. UTF-8 is validated; a BOM is used when present; legacy encodings must be chosen explicitly because guessing between GBK and Shift_JIS is unreliable.

  3. 3

    Transform as a pure function

    Escaping, quoting, case changes and line-ending normalisation are applied to the decoded string, so the same input always gives the same output.

  4. 4

    Encode and download

    The result is encoded back to UTF-8 (or the format's own escaping rules) and returned as a Blob.

  5. Processing pipeline

Why a file looks like mojibake

Mojibake is the same bytes decoded with the wrong table: Shift_JIS read as UTF-8, or GBK read as Latin-1. Nothing is corrupted in the file itself. If the output is garbled, the fix is to re-run with the correct source encoding, not to edit the text by hand — editing bakes the wrong characters in permanently.

CSV quoting is not optional

A CSV field containing a comma, a quote or a newline must be wrapped in double quotes, and inner quotes doubled. Tools that skip this produce files that look fine until someone imports them and the columns shift. This converter applies RFC 4180 quoting on output.

Where text tools stop

There is no reliable way to detect an unknown legacy encoding from content alone, and no way to recover bytes that were already lost. Mixed encodings inside one file cannot be fixed automatically. Very large inputs are capped because regular expressions and repeated string concatenation can take quadratic time.

Verify it yourself

Text is transformed in memory. Nothing is sent while it runs.

  1. 1.Open DevTools on this page and switch to the Network tab
  2. 2.Keep the filter on Fetch/XHR and run the tool
  3. 3.Confirm no request carries your file — you should see only page assets and fonts

Frequently asked questions

How strong is it?

It is a lightweight XOR + Base64 obfuscation, not suitable for long-term storage of sensitive data.

What if I lose the key?

The text cannot be recovered. Keep your key somewhere safe.

Is data uploaded?

No. Both the key and the text stay in your browser.

What this kind of conversion cannot keep

Text tools never leave the page: the string you paste is transformed in memory and written back to the result box. There is no request, no log and no retention, which also means there is no way to recover a value you closed the tab on.

More in Text