XOR checksum calculator
The XOR checksum calculator combines an ordered list of byte values into one 8-bit integrity value.
Run — free
Enter integers from 0 through 255 and receive the checksum in decimal, hexadecimal, and binary, together with a readable expression showing the calculation. XOR checksums are common in compact serial messages, embedded-device commands, legacy data formats, and simple LRC-style protocols because they require very little processing. This calculator is designed for checking examples, debugging frames, preparing test vectors, and reproducing a protocol specification without writing a one-off script.
How an XOR checksum is calculated
An XOR checksum starts with an accumulator of zero and applies the bitwise exclusive OR operation to each byte in sequence. For every bit position, XOR produces one when the two compared bits differ and zero when they match. Applying that rule repeatedly leaves a single byte after the entire list has been processed. For example, the same value XORed twice cancels because x XOR x equals zero, while XORing with zero leaves a value unchanged. The operation is associative and commutative, so grouping or reordering the selected bytes does not change the final result, although the protocol still determines exactly which fields belong in the calculation. This calculator validates that every supplied item is an integer between 0 and 255, performs the pass, and formats the same resulting value three ways. Decimal is convenient for general APIs, hexadecimal aligns naturally with packet dumps and datasheets, and the eight-character binary form makes individual bits visible. The expression in the response provides a compact record of all operands and the final hexadecimal checksum.
Choose the correct bytes from a message
The arithmetic is simple, but selecting the correct portion of a frame is the part that most often causes disagreement. Read the protocol definition carefully to determine whether the start delimiter, address, command, payload length, payload, existing checksum field, and end delimiter are included. Usually the checksum byte itself is excluded, but conventions vary. Convert textual hexadecimal octets such as 7E, 01, and A4 to their integer values before submitting them: those three inputs become 126, 1, and 164. Do not submit character code points unless the protocol explicitly checks encoded text. If a field contains the ASCII character “7,” its byte is normally 55 decimal, whereas a numeric field with value seven is 7; those are different inputs and yield different checksums. Multi-byte numbers also require the correct wire order. A 16-bit value may appear high byte first or low byte first depending on endianness. Build the byte list exactly as transmitted, then compare the returned hexadecimal value with the frame or documentation. The reported byte count helps confirm that no field was accidentally omitted or included twice.
What this integrity check can and cannot prove
An XOR checksum is useful when a protocol needs an extremely small, fast check and its specification already requires this algorithm. It can detect any single-bit change and many other accidental changes, which makes it practical for quick diagnostics on short serial frames and constrained devices. However, it is much weaker than a CRC or cryptographic hash. Two identical bit errors in different bytes can cancel, rearranging bytes does not affect the result, and an attacker can deliberately alter data while compensating elsewhere to preserve the checksum. Treat the output as a compatibility and troubleshooting value, not as evidence that data is authentic or protected against tampering. When designing a new protocol rather than implementing an existing one, consider a well-specified CRC for accidental transmission errors or an authenticated construction such as a message authentication code when security matters. For repeatable testing, save both the exact byte list and the returned expression in your fixture. The browser calculator runs the same deterministic logic as the API, while automated calls cost $0.002 each, so interactive checks and production test pipelines produce matching values.
What you can do with it
Debug a serial frame
Recalculate the checksum over the documented frame fields and compare it with the byte received from a device.
Create protocol test vectors
Generate stable decimal, hexadecimal, and binary results for fixtures used by firmware, drivers, and integration tests.
Verify embedded commands
Check a command packet before transmission and confirm that byte conversions and field inclusion match the device manual.
FAQ
What values can I enter?
Enter a non-empty array of integers from 0 through 255. Each integer represents exactly one byte.
Does byte order affect an XOR checksum?
No. XOR is commutative, so reordering the same byte values leaves the checksum unchanged, although you should preserve wire order when documenting and debugging a frame.
Should I include the checksum byte itself?
Follow the protocol specification. Most calculations exclude the checksum field, but some verification procedures XOR the complete frame and expect a defined residue.
Is this the same as a CRC?
No. A CRC uses polynomial division and detects broader classes of transmission errors. A simple XOR checksum is lighter but substantially weaker.
Can I use hexadecimal input strings?
The input contract accepts integer byte values. Convert each hexadecimal octet to its integer equivalent before calling the calculator.
What does an API calculation cost?
Each API request costs $0.002. The in-browser calculator is available for interactive checks.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/elec/xor-checksum \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"bytes":[72,101,108,108,111]}'const res = await fetch("https://api.kit.forhosting.com/elec/xor-checksum", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"bytes": [
72,
101,
108,
108,
111
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/elec/xor-checksum",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"bytes": [
72,
101,
108,
108,
111
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/elec/xor-checksum", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"bytes":[72,101,108,108,111]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"bytes":[72,101,108,108,111]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/elec/xor-checksum", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"bytes": [
72,
101,
108,
108,
111
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "elec.xor_checksum",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_items | 65536 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |