Toolbox
Calculators, ciphers and decoders that show the whole procedure, not just the answer. Everything runs in your browser: nothing you type is sent anywhere.
What do you want to do?
No tool matches that. Try a shorter word.
Modular arithmetic
Remainders, divisibility and congruences, the arithmetic underneath most of cryptography.
- Modulo calculator The remainder of a divided by n, also for negative and huge numbers, with every convention.
- GCD and LCM calculator Greatest common divisor with Euclid's algorithm step by step, and the least common multiple.
- Modular inverse calculator The number x with a times x congruent to 1 mod n, with the extended Euclidean algorithm in a table.
- Euclidean division calculator Quotient and remainder with a = q times b + r, long division written out, and the sign conventions for negative numbers.
- Extended Euclidean algorithm Bezout coefficients s and t with s times a plus t times b equal to the gcd, from the table and by back-substitution.
- Modular exponentiation calculator The power a to the e modulo n by square and multiply, bit by bit, also for negative and huge exponents.
- Modular arithmetic calculator Evaluate an expression with plus, minus, times, division and powers modulo n, every operation shown and reduced.
- Linear congruence solver All solutions x of a times x congruent to b modulo n, with the gcd condition and the inverse.
- Chinese remainder theorem calculator Solve a system of congruences x congruent to r modulo m, coprime or not, with every step and a check.
- Base converter Whole numbers between any bases (binary, octal, decimal, hex, base 36, Base64 digits, base 60), with Horner's scheme and repeated division.
- Tables of Z/nZ Addition, multiplication and power tables modulo n, with units, inverses, zero divisors and the group of units.
Primes and number theory
Factoring, primality, orders, roots and logarithms modulo n, the number theory that public key cryptography is built on.
- Prime factorization calculator Split a number into prime powers, by trial division and then Pollard's rho, every step shown.
- Primality test Is n prime? Trial division, Fermat's test and Miller-Rabin with every base and every squaring shown.
- Euler's totient calculator Euler's phi of n, how many numbers up to n are coprime to n, from the prime factorization.
- Divisors calculator All divisors of n, their number and their sum, and whether n is perfect, abundant or deficient.
- Multiplicative order calculator The smallest k with a to the k congruent to 1 mod n, testing only the divisors of the group exponent.
- Primitive root calculator Whether n has a primitive root, the smallest one with the standard test, and the list of all of them.
- Legendre and Jacobi symbol calculator The symbol (a/n) by reduction, the rule for 2 and quadratic reciprocity, with Euler's criterion as a check.
- Modular square root calculator Solve x squared congruent to a mod n, with Tonelli-Shanks for primes and the CRT for composite n.
- Discrete logarithm calculator Solve g to the x congruent to h mod p by baby-step giant-step, with both tables shown.
- Continued fraction calculator The continued fraction of a fraction, a decimal or a square root, with the convergents and Pell's equation.
- Prime sieve and next prime The sieve of Eratosthenes up to N as a grid of crossed-out numbers, and the next and previous prime of any n.
- Carmichael function calculator Lambda of n, the smallest exponent that sends every unit mod n to 1, compared with Euler's phi.
Encodings and converters
How text and numbers become bytes and bits, and back. Nothing here is secret, but every cipher and hash works on these representations.
- Text to character codes Every character with its Unicode code point in decimal, hex and binary, and codes back to text.
- Text to hex converter Text to hexadecimal bytes (UTF-8) and hex back to text, with each byte split into two nibbles.
- Text to binary converter Text to groups of 8 bits (the UTF-8 bytes) and binary back to text, with the place values.
- Base64 encoder and decoder Base64 step by step, 3 bytes into 4 characters of 6 bits, with padding and the URL-safe alphabet.
- Base32 encoder and decoder Base32 (RFC 4648) step by step, 5 bytes into 8 characters of 5 bits, with padding.
- Base58 encoder and decoder Base58 with the Bitcoin alphabet, as repeated division of one big number by 58, with leading zero bytes.
- URL encoder and decoder Percent-encoding of each UTF-8 byte (%20, %C3%A9) and decoding, for URL parts, whole URLs and form data.
- UTF-8 encoder and decoder The UTF-8 bytes of each character with the bit layout filled in, and bytes back to text with every error explained.
- Morse code translator Text to Morse code and back (letters, digits and punctuation), with the timing in units.
- XOR calculator (repeating key) Text or hex XOR a repeating key, byte by byte with all the bits, and XOR again to get the data back.
- Bitwise calculator AND, OR, XOR, NOT, NAND, NOR and shifts on whole numbers of any size, with the bits aligned in a grid.
- Two's complement converter A signed integer to n-bit two's complement and back, with invert and add one, and the range check.
- IEEE 754 floating point converter A decimal number to single or double precision bits (sign, biased exponent, mantissa) with the exact stored value and the rounding error, and back.
- Gray code converter Binary to Gray code (b XOR b shifted right) and back with a prefix XOR, and the table of all n-bit codes.
- Hamming distance calculator The number of positions where two strings, bit strings or hex values differ, with the differences marked.
- SHA-256, SHA-1 and MD5 step by step The hash of a text or bytes with the padding, the message schedule and every round of the compression in a table.
- Text to number converter Text to one big integer through its UTF-8 bytes (big-endian), as in textbook RSA examples, and a number back to text.
Classical ciphers
Pen and paper ciphers from Caesar to the First World War, each worked through letter by letter, both ways.
- Caesar cipher Shift every letter by a fixed number of places, any shift, encrypt and decrypt, with the letter table.
- ROT13 and ROT47 The self-inverse rotations ROT13 (letters), ROT5 (digits), ROT18 and ROT47 (all visible ASCII characters).
- Atbash cipher The alphabet read backwards: A and Z swap, B and Y, and so on. Encrypting and decrypting are the same.
- Affine cipher Encrypt with a times x plus b modulo 26; decryption with the inverse of a computed step by step.
- Keyword substitution cipher A monoalphabetic substitution with a keyed alphabet (keyword first, then the other letters) or any 26 letter alphabet.
- Vigenère cipher A repeated keyword shifts each letter by a different amount, with the tabula recta rows and the sums modulo 26.
- Beaufort cipher Like Vigenère, but the letter is subtracted from the key letter, so encrypting and decrypting are one operation.
- Autokey cipher Vigenère's autokey: a short primer followed by the plaintext itself as the key, so the key never repeats.
- Playfair cipher Pairs of letters in a 5x5 keyword square, with the same row, same column and rectangle rules shown for every pair.
- Hill cipher Blocks of 2 or 3 letters multiplied by a key matrix modulo 26, with the determinant and the inverse matrix.
- Rail fence cipher Write the text in a zigzag over several rails and read it rail by rail; the zigzag is drawn out.
- Columnar transposition Write the text in rows under a keyword and read the columns in alphabetical order of the key letters.
- Scytale The Spartan rod: write along the rod, unwind the strip and read it turn by turn; decryption winds it back.
- Polybius square Every letter becomes two coordinates in a 5x5 or 6x6 square, plain or keyed, with digits or letters as labels.
- Bifid cipher Delastelle's cipher: Polybius coordinates written in two lines, read across and paired up again, with a period.
- ADFGVX cipher The German cipher of 1918: a keyed 6x6 square with the labels A D F G V X, then a columnar transposition.
- Bacon's cipher Every letter as five binary symbols (24 or 26 letter alphabet), written with two symbols or hidden in letter case.
- One-time pad Each letter shifted by its own random key letter, mod 26: perfect secrecy, as long as the key is never reused.
Code breaking
Breaking classical ciphers without the key, by counting letters and measuring how English a text looks.
- Frequency analysis Letter counts and shares next to English, the commonest bigrams and trigrams, doubled letters and the index of coincidence.
- Index of coincidence calculator The IC of a text with the counts written out, Friedman's estimate, and the average IC of the columns for every period, to find a Vigenère key length.
- Kasiski examination Repeated sequences in a Vigenère ciphertext, the distances between them and their factors, to find the key length.
- Caesar cipher breaker All 26 shifts tried and ranked by how English the result looks, with quadgram scores, chi-squared and the best decryption.
- Affine cipher breaker All 312 affine keys tried and ranked by English fitness, with the E and T shortcut and the decryption table.
- Vigenère cipher breaker Finds the key length with the IC and Kasiski, solves every column as a Caesar shift by chi-squared, and gives the key and the plaintext.
- Substitution cipher solver Solves a monoalphabetic substitution by hill climbing on English quadgram fitness, with restarts and letters you fix by hand.
- Transposition cipher breaker Tries every rail fence and every columnar transposition order up to 8 columns (hill climbing beyond) and ranks them by English fitness.
- Cipher identifier Guesses which cipher or encoding produced a text from its characters and statistics, with the reasons and the tool to try next.
- Decoder guesser Tries Base64, Base32, hex, binary, decimal codes, Morse, URL encoding, ROT13, Atbash and reversing, also two in a row, and ranks what reads best.
Modern cryptography
Public key encryption, signatures, key exchange, elliptic curves, secret sharing and lattices, worked through with small numbers so that every step can be checked by hand.
- RSA encryption and decryption RSA keys from two primes, encryption and decryption by square and multiply, and the faster decryption with the Chinese remainder theorem.
- RSA signatures Sign with the private exponent and verify with the public one, on a number or on a SHA-256 hash, with the textbook pitfalls explained.
- Diffie-Hellman key exchange Two parties agree on a shared key over an open channel, with the group parameters checked (order of g, safe prime) and both sides computed.
- ElGamal encryption ElGamal public key encryption step by step, with a fresh random nonce, and decryption through the inverse of the shared value.
- Schnorr signatures Schnorr signing and verification in a subgroup of prime order, with SHA-256 or a simple toy hash, every exponentiation shown.
- Elliptic curve point arithmetic Add and double points on y^2 = x^3 + ax + b over a prime field with the slope formulas, and multiply by a scalar with double and add.
- Points of an elliptic curve Every point of a curve over a small prime field, the group order and the Hasse bound, the order of each point, the group structure and a generator.
- Elliptic curve Diffie-Hellman (ECDH) Key agreement on an elliptic curve, from small toy curves to secp256k1, with both public keys and the shared point computed on both sides.
- Shamir secret sharing Split a secret into n shares so that any t of them recover it, and reconstruct it with Lagrange interpolation, every coefficient shown.
- GF(2^8) arithmetic (AES field) Add, multiply and invert bytes in the AES field with xtime, polynomial long division and the extended Euclidean algorithm, plus the S-box value.
- Polynomials over a prime field Add, multiply and divide polynomials with coefficients modulo p, with long division, Euclid's gcd and the inverse modulo another polynomial.
- Paillier encryption Paillier keys, encryption and decryption, and the additive homomorphism: multiplying two ciphertexts gives an encryption of the sum.
- Lattice reduction (LLL and Lagrange-Gauss) Reduce a lattice basis with exact fractions, Lagrange-Gauss in dimension 2 and LLL with Gram-Schmidt, size reduction and the Lovász condition at every step.
- Learning with errors (toy LWE encryption) Regev-style encryption of one bit under learning with errors, with small parameters, showing why decryption works and when the error breaks it.
- Birthday bound and brute force The chance of a collision among k random values out of N, the number needed for 50%, and how long a brute force search of a key takes.
General maths
Exact calculators for the algebra and counting underneath cryptography (matrices, equations, fractions, binomials, huge numbers), every step written out.
- Matrix calculator Determinant, inverse, product, transpose, rank and echelon forms, over the fractions or modulo n, with every row operation shown.
- System of linear equations solver Solve A x = b by Gaussian elimination over the fractions or modulo a prime, with one, none or infinitely many solutions.
- Fraction calculator Add, subtract, multiply and divide fractions and mixed numbers, with the common denominator, the simplification and the decimal expansion.
- Binomial coefficient calculator C(n, k), n choose k, by the product formula with the factors cancelled, Pascal's triangle, and modulo a prime with Lucas' theorem.
- Permutations and combinations calculator Count arrangements and choices with or without repetition, multinomials, circular orders and derangements, with the formula and what it counts.
- Polynomial long division calculator Divide one polynomial by another with exact fractions, in the long division layout, with synthetic division for x - c and a check.
- Big number calculator Exact arithmetic on whole numbers of any size, with the order of evaluation, the digits, the bits and the scientific form.
- Number of bits and security level How many bits and digits a number has, the rule 2^k = 10^(0.301 k), and what key sizes like 2^128 or RSA-2048 mean.