XOR Calculator

XOR two or more inputs, from a single bit to files of many megabytes. Runs in the browser and keeps working offline.

Input A format

Input B format

Result

Result format

Type or paste an input and the result appears here, or load an example.

Explanation

Once there’s a result, this lines up the inputs and the result column by column.

What people use it for

Security challenges

Capture-the-flag and reverse-engineering exercises often hide data with XOR. The Repeat option handles a key shorter than the message, and XORing hidden data with a known part of the original reveals the key.

attack at dawn ⊕ key

Device codes

Diagnostic and configuration procedures for some vehicles and electronics ask for a code XORed with a fixed value. Results keep their leading zeros, so a four-digit code stays four digits.

1234 ⊕ 1f00 = 0d34

Cryptographic key components

A key split into components, each held by a different person, is rebuilt by XORing all of them, one input per component.

8B3F… ⊕ 5E92… ⊕ C4D7…

Bit masks

XOR with 1 flips a bit and XOR with 0 leaves it unchanged, so the mask 11110000 inverts the high four bits.

11001010 ⊕ 11110000

Teaching

Courses on binary logic, parity and ciphers. Numbers are XORed bitwise, and the Explanation shows the bits lined up: 1100 ⊕ 1010 = 0110.

12 ⊕ 10 = 6

Converting

With a single input, the page converts between binary, decimal, hex, Base64 and ASCII.

48656c6c6f → Hello

How it works

XOR truth table

XOR (exclusive or) compares two bits and gives 1 when they differ and 0 when they match. Longer inputs are lined up and XORed bitwise.

A ⊕ B for each pair of bits
ABA ⊕ B
000
011
101
110

Anything XORed with itself is zero, and XORing twice with the same value undoes the first XOR: (a ⊕ k) ⊕ k = a. That is why XOR shows up in ciphers, checksums, parity and key splitting.

With three or more inputs the result is A ⊕ B ⊕ C …. XOR is commutative and associative, so neither the order nor the grouping of the inputs changes the result.

An empty input is ignored, which gives the same result as an input of zeros. A single input is shown in the result’s format. Choose Hex for Input A and ASCII for the result, and the calculator works as a converter.

Input formats

Binary
The digits 0 and 1, one bit each. Spaces, the separators : - _ , . and 0b prefixes are ignored.
Decimal
A whole number, 0 or more. Spaces and underscores between digits are ignored, and thousands separators work: 1,000,000, 1.000.000 and 10,00,000 are all a million. It’s stored in the fewest whole bytes that hold it, so 32 uses one byte.
Hex
The digits 0–9 and letters a–f or A–F, four bits each. Spaces, the same separators, and 0x or \x prefixes are ignored.
Base64
The standard alphabet with + / or the URL-safe one with - _, with or without = padding. Spaces and line breaks are ignored.
ASCII
Each character is one byte, including spaces and line breaks. Characters outside ASCII, such as é or emoji, are encoded as UTF-8, which takes two to four bytes each.
Files
Drop a file on an input, paste one, or choose Open file. Its bytes are used exactly as they are, up to 64 MB per file. Several files at once take one input each, starting with that input. If a file holds text such as hex digits, the page offers to use the text instead.

In binary, decimal, hex and Base64, characters typed in full width, such as 0xFF, and digits from other writing systems, such as the Eastern Arabic ٣ or the Devanagari ३, count as their ASCII forms, 0xFF and 3.

Inputs of different lengths

When the inputs aren’t the same length, choose how to line them up. Every shorter input is treated the same way. With 1011 and 110:

Alignment options with an example
Align rightPads the shorter input with leading zeros, the way numbers line up.1011 ⊕ 0110 = 1101
Align leftPads the shorter input with trailing zeros, so the inputs line up at the start.1011 ⊕ 1100 = 0111
RepeatRepeats the shorter input to full length, as in a repeating-key cipher. When the longer length isn’t a multiple of the shorter, the last repetition is incomplete.1011 ⊕ 1101 = 0110
TruncateDrops the part of the longer input that has no partner.101 ⊕ 110 = 011

Output formats

Results keep their leading zeros, so they are as long as the longest input, or the shortest when truncating. ff00ff ⊕ ff0000 is 0000ff, not ff.

Binary
Every bit of the result.
Decimal
The result as a whole number, which has no leading zeros. Results longer than a million digits aren’t shown in decimal.
Hex
Four bits per digit. A result whose length isn’t a multiple of four bits gets leading zeros, and a note says so.
Base64
The standard alphabet with = padding. Like ASCII it needs whole bytes, so other lengths get leading zeros and a note.
ASCII
One character per byte. Bytes that aren’t printable ASCII appear as escapes such as \x00, \n and \t, and a backslash appears as \\. Spaces show as spaces, so a result can start or end with spaces that are hard to see; the Explanation marks each one with ␣. Turn off escaping to read the bytes as UTF-8 text.
Download
Saves the result as a file of raw bytes. It appears when an input is a file, or when the result is too long to show in full. The file takes the name of the first input file, with .xor added or removed, so XORing photo.jpg with a key gives photo.jpg.xor, and XORing that with the same key gives back photo.jpg.

Limits

Inputs
Up to 26, named A to Z.
Files
Up to 64 MB each. How many large files fit at once depends on the device’s memory.
Decimal
Up to a million digits, in an input or a result.
Text
No set limit for typed or pasted text, but longer text takes longer: about a second for 4 million hex digits on a computer, longer on a phone.
Result
The box shows the first 100,000 characters, and Copy includes all of them, up to 16 million. A longer result also shows its first 100,000 characters, and Download saves all of it.
Share links
Up to 8,000 characters, with typed or pasted inputs only, not files. A longer link doesn’t open.

Privacy

The calculation runs in the browser, in this page’s JavaScript. Typed inputs stay in the page: the page doesn’t send them to the server or store them. A file is read by the browser from the device, and its contents stay in the page too.

Ways to check how it works:

  • Go offline. Turn off Wi-Fi or switch to airplane mode, then keep calculating. The calculator keeps working, because it doesn’t need the server once the page has loaded.
  • Watch the network. Open the browser’s developer tools (F12 on most computers), choose the Network tab, and type. Calculating adds no requests.
  • Read the code. View the page source: the scripts are plain, readable JavaScript. The server also sends a content security policy that includes connect-src 'none', which tells the browser to block any connection the page tries to open. The developer tools show the policy in the page’s response headers, on the Network tab.

The server delivers the page and its files. Like most web servers, it logs each request: the time, the address it came from and how the browser describes itself.

The page keeps its display settings (formats, alignment, spacing and so on) in the browser’s local storage, under xor-calculator:settings, and stores nothing else. What this browser has stored for this page now:


            
          

A share link carries its inputs in the link itself, after the #. Browsers do not send that part, the URL fragment, when they request a page; this page reads the inputs from it, removes them from the address bar and asks before filling them in. Anyone with the link can read the inputs, and the link stays in the browser’s history.

About this site

xor.pw has been calculating XOR since 2013. Originally, every calculation went to the server, where PHP’s GMP library did the work. In 2026, Claude, an AI model made by Anthropic, built this version, working with the site’s owner.

This version runs as JavaScript in the browser, and the server only delivers the page. Each input becomes bytes in a Uint8Array, the bytes are combined with JavaScript’s ^ operator, and decimal numbers are converted with BigInt.