File encoding guides

Trace a repeating XOR key through three bytes

·

Use a short practice message to see where the key cycles and what the byte operation does. A byte result can have several display formats. Read the hex or binary table when you want to inspect the operation independently of text decoding.

XOR Cipher Tool

Read a repeating key in the byte table

Select Load example and Apply XOR. Input data is OK! in UTF-8. The key is 1F 03 with Hexadecimal selected. The result is 50483E, which contains three bytes.

The third position returns to key byte 1. Read 21 and 1F on that row. In binary they are 00100001 and 00011111. A result bit is one wherever the two input bits differ. The result is 00111110, or 3E.

Read a repeating key in the byte table
PositionInput byteKey byteResult byte
14F1F50
24B0348
3211F3E

ECMAScript 2025 — Numeric bitwise XOR

Recover the original with the same key

While Hexadecimal is selected for output, choose Use result as input. The tool puts 50483E in Input data and changes Input format to Hexadecimal. Keep key 1F 03, change Output format to UTF-8 text and apply XOR again. The result field shows OK! again.

On the first pass, switch Output format to Base64 to read UEg+ for the same result bytes. For a byte-by-byte check, open the raw download in a hex viewer and confirm 50 48 3E.

RFC 4648 — Base16 and Base64 encodings

Keep bytes that fail UTF-8 decoding

Enter FF as hexadecimal input and 01 as a hexadecimal key, then choose UTF-8 text and apply. The byte table shows FE, which has no valid UTF-8 interpretation on its own.

Select Hexadecimal to read FE or download the single byte directly. The application reports invalid UTF-8 instead of substituting a replacement character. Use this workflow to check local classroom examples and test fixtures.

WHATWG Encoding Standard — TextDecoderRFC 4648 — Base16 and Base64 encodings

Common questions

Does changing the output format change the XOR calculation?

The calculation always uses the selected input and key bytes. Output format chooses how the same result bytes are displayed.

How many bytes are shown in the explanation?

The table shows up to 16 positions. The textual result and binary download still contain every result byte.

Sources

Put it into practice.

Related guides