Shamir Secret Sharing

Split a secret into n shares so any k recover it, and combine shares.

Text up to 10,000 characters (UTF-8).

More options

Split: any k shares recover the secret. Combine: used to check extra shares for consistency.

Split only. With a seed the shares are predictable; leave empty for real use.

Try an example: · ·

More about this tool

Part of Keysmith Cryptography & security tools

How it works

Splits a secret (recovery code, password, key) into n shares with a threshold k using Shamir's scheme over GF(256): any k shares reconstruct it, fewer reveal nothing. Combines and verifies shares with an optional checksum.

  • Each byte of the secret is the constant term of its own random polynomial of degree k−1 over GF(2^8) (field polynomial x^8+x^4+x^3+x+1, as in AES). Share i holds the value of every polynomial at x = i (i = 1…n), so a share is as long as the secret.
  • Combining uses Lagrange interpolation at x = 0. Any k shares give the secret; with k−1 or fewer, every possible secret is equally consistent with the shares (information-theoretic security).
  • Optional checksum: the first 4 bytes of SHA-256(secret) are appended before splitting. After combining, a wrong share or too few shares are detected with probability 1 − 2^−32.
  • Shares are written as "<index>-<data>" in hex or Base64. The format is not interchangeable with other tools (e.g. ssss-split, which uses a larger field).
  • With JavaScript on, the page splits and combines with crypto.getRandomValues. Without JavaScript or via the API the server does it with Node.js crypto and does not store anything.

Store shares in different places and test recovery before relying on them. Anyone holding k shares can recover the secret.

Sources

Use this tool in an app

These free programs for your browser have this tool built in, next to everything else the task needs.

  • Keysmith Crypto & secrets lab

    Audit certificates, keys, TLS and passwords in one lab; server runs ask first.

    Open Keysmith

Related tools

How to use Shamir Secret Sharing

Split a recovery code or key into n shares so that any k of them rebuild it, combine shares again, and avoid the mistakes that lock you out.

What it is for

Some secrets are too important to keep in one place and too dangerous to copy: the recovery phrase for a crypto wallet, the master password of a family password manager, the unseal key of a server vault. Shamir's scheme solves this. You split the secret into n shares and choose a threshold k. Any k shares rebuild the secret exactly. Fewer than k reveal nothing about it, not even a single bit.

Typical setups are 3-of-5 (shares with family members, a lawyer and a safe-deposit box) or 2-of-3 (one at home, one at work, one with a friend). The tool works on text up to 10,000 characters, writes shares in hex or base64, and can add a 4-byte checksum so a wrong or missing share is detected instead of silently producing garbage.

Its share format is its own. Shares can't be combined with other tools like ssss-split, which uses a different field.

Worked example

Split correct horse battery staple into 5 shares with threshold 3 and the checksum on. We used a demo seed so you can reproduce it; never do this for real secrets.

The tool reported "Split a 28-byte secret into 5 shares; any 3 of them recover it, 2 or fewer reveal nothing." Each share is 32 bytes (28 + 4 checksum), for example:

1-ee23a34dc787be4d8af7916bb9d669417a54d63602154ed4db2ff116b421013a
3-ac721e5b9f43f6ca6776a86e6d38d61c86b773028d0747eaa1987125c62a63f5
5-7d88d2da6b481f3783705eb5cd759e8f3433ca98f8ca8b277b7e58092ea75c9d

Combining these three, in any order, gave "Recovered a 28-byte secret from 3 shares (checksum verified)" and the original text. With only shares 1 and 3, the tool answered "The 2 shares did not give a valid secret (checksum mismatch)" and explained that the shares are wrong, from different secrets, or fewer than the threshold. Four shares worked too.

How to read the result

  • Split: the share count, threshold, secret length, share length and the shares themselves. The number before the dash is the share's index. Keep it, because combining needs it.
  • Combine: which share indices were used, the secret as text and hex, and whether the checksum is valid.
  • Consistent: if you give more than k shares, the extras are checked against the result, which catches a corrupted share.

Tips and common mistakes

  • Test recovery before you rely on it. Combine a different set of k shares right after splitting, then delete the original only if you mean to.
  • Keep the checksum on. Without it, wrong shares produce a wrong secret with no warning.
  • Write down the threshold and which tool made the shares, together with each share. In ten years nobody will remember "it was 3-of-5 from usefulweb.site".
  • Store shares in places that won't fail together. Five shares in one desk drawer are one share.
  • Anyone who gathers k shares has the secret. Choose k so that no small group of holders can collude by accident.
  • Leave the seed empty for real use. With a seed, the shares are predictable.

FAQ

Is it really impossible to learn anything from k − 1 shares?

Yes. With fewer than k shares, every possible secret of that length is equally consistent with them. The security is information-theoretic and doesn't depend on computing power.

Why is each share as long as the secret?

Each byte of the secret gets its own random polynomial, and every share stores one value per byte, plus 4 bytes if the checksum is on.

Can I add more shares later?

Not to an existing split. Split again with a larger n and replace all the old shares.

Should I split a seed phrase or encrypt it?

Splitting removes the single point of failure without needing a password to remember. Some people do both: encrypt the file, then split the password.

Guide last updated:

For scripts and AI agents

  • JSON API: POST https://shamirsecretsharing.usefulweb.site/api/v1/calculate (same calculation as this page)
  • Interface description: OpenAPI 3.1 · AI guide: llms.txt
  • MCP server (Streamable HTTP): https://shamirsecretsharing.usefulweb.site/mcp · tool name shamir_secret_sharing
Example request
curl -s -X POST https://shamirsecretsharing.usefulweb.site/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{"action":"split","secret":"correct horse battery staple","shares":5,"threshold":3,"seed":"demo"}'
Feedback · ideas & bug reports welcome