What is Argon2?

In short
Argon2 is a password hashing function that turns a password into a fixed-length tag while deliberately using a lot of memory and time. That cost makes guessing passwords in bulk slow and expensive for attackers. It was standardized in RFC 9106, and Argon2id is its recommended variant for password hashing.
How it works
Argon2 is a memory-hard function. That means computing its output needs a large block of memory, not just raw CPU cycles. Attackers who run guessing attacks on GPUs or custom chips have far less memory per unit than general-purpose processors, so memory-hard designs cut into their advantage.
The input includes a password, a salt, and several tuning parameters. The salt is a random value that makes each hash unique, even for identical passwords. The parameters control three things: memory size, number of passes over that memory, and degree of parallelism, which is the number of lanes that can be computed side by side.
Internally, Argon2 fills a matrix of 1024-byte blocks. Each new block is derived from earlier blocks, and the function runs over the memory several times. The final block is combined into the tag, which is the output you store. The specification relies on BLAKE2b as its underlying hash.
Variants: Argon2d, Argon2i and Argon2id
Argon2 has three variants. Argon2d picks memory locations based on the data itself. That gives strong resistance to time-memory trade-off attacks, but it leaks timing information, so it suits proof-of-work and cryptocurrency-style uses where side-channel timing is not a threat.
Argon2i uses memory access patterns that do not depend on the secret input. That protects against side-channel attacks and is the usual choice for password-based key derivation, though it needs more passes to resist trade-offs.
Argon2id mixes both approaches. According to the document, it behaves like Argon2i for the first half of the first pass over memory and like Argon2d for the rest. The specification states that Argon2id MUST be supported by any implementation, while Argon2d and Argon2i are optional. For most password storage, Argon2id is the variant to pick.
Choosing parameters
The three tuning knobs are memory size (given in kibibytes), passes, and parallelism. Memory size has the biggest effect on attacker cost, so set it as high as your servers can comfortably handle for each login. Passes let you tune running time without changing memory use. Parallelism sets how many lanes run at once and should match the cores you can spare.
The specification recommends a 16-byte salt for password hashing and says the salt should be unique for each password. The tag length must be at least 4 bytes, and the document describes the version as 0x13. Check the current guidance and your library's defaults before you deploy, since recommended values change as hardware improves.
A simple example
Most developers never implement Argon2 by hand. They call a well-tested library. The pattern looks like this in general terms: generate a random salt, choose memory, passes and parallelism, hash the password, and store the encoded result, which includes the parameters and salt next to the tag. When you verify a login, you read those stored values and recompute the hash with the same settings.
Storing the parameters alongside the hash lets you raise the cost later without breaking existing users. Old hashes still verify with their original settings, and you can rehash them on the next successful login.
Common mistakes
A common mistake is picking settings that are too weak because they feel fast in testing. A hash that takes a few milliseconds is cheap to attack at scale. Another mistake is reusing a salt across passwords, which the specification explicitly discourages. Some teams also choose Argon2d or Argon2i without a clear reason, when Argon2id covers both concerns.
Do not treat Argon2 as encryption. It turns a password into a one-way tag. You cannot recover the password from it, and you should never try to decrypt or reverse stored tags.
Alternatives
Bcrypt and scrypt are older password hashing options. Bcrypt is widely supported but is not memory-hard in the same way. Scrypt is also memory-hard and was an earlier design. Argon2 was the winner of the Password Hashing Competition, and RFC 9106 is an informational document rather than an Internet Standard, so it is a well-documented reference rather than a formal protocol requirement. Whichever function you choose, the parameters and storage format matter as much as the algorithm name.
FAQ
Is Argon2 an encryption algorithm?
No. Argon2 is a password hashing function. It produces a one-way tag from a password, and that tag cannot be turned back into the original password. Encryption is designed to be reversed with a key, which is a different goal.
Which Argon2 variant should I use for passwords?
Argon2id is the usual choice. The specification says every implementation must support it, and it combines protection against side-channel timing attacks with resistance to time-memory trade-offs.
Why is Argon2 called memory-hard?
Computing the function requires a large amount of memory that must be filled and read during the work. This makes it expensive for attackers to run many guesses in parallel on hardware with limited memory per core.
Do I need to create my own salt?
Generate a fresh random salt for each password using a secure random source, and store it with the hash. Most Argon2 libraries do this for you when you use their high-level hashing functions.
Sources
This page is based on the official documentation below. Read it for full detail.
Argon2 — official documentation ↗