A hash function takes any input, a password, a photo, a whole disk image, and produces a fixed size output called a hash or digest. The input cannot be recovered from the output: hashing is a one way street, unlike encryption, which is designed to be reversed with a key. The same input always gives the same output, while a one character change scrambles the result completely, a property called the avalanche effect. Good hash functions spread outputs evenly across their whole range, so two inputs landing on the same hash, a collision, should be practically impossible to find on purpose. The output size is fixed by the algorithm: SHA-256 always gives 256 bits, however large the input.
Hashes are the workhorses of trust in computing. Websites store password hashes instead of passwords, so a leaked database does not directly reveal them. Downloads publish hashes so you can verify a file arrived intact and untampered. Digital signatures hash a document and sign the hash. Version control systems like Git name every file and commit by its hash, making corruption or quiet edits detectable. Even the deduplication in backup tools, which avoids storing the same file twice, works by hashing chunks and comparing. Whenever software needs to ask whether these two things are identical, or whether this thing has changed, without comparing every byte, a hash is usually the answer.
A longer hash gives more possible outputs and more collision resistance, but length alone is not strength: the algorithm's design decides whether shortcuts exist. MD5, once everywhere, is now considered broken for security because collisions can be manufactured, and SHA-1 followed it into retirement for certificates. Both remain fine as accidental corruption checks, and dangerous as proof against a deliberate attacker. The modern defaults are the SHA-2 family, especially SHA-256, and SHA-3. The hash length calculator here shows the exact output sizes of the common algorithms in bits, bytes, hex and Base64, which is what you need when sizing a database column or checking a published checksum. A homely test makes hashes tangible: many download pages publish a SHA-256 value beside the file. Compute the hash of what you downloaded, with a built in tool on any modern system, and compare the two strings character by character. If they match, the file is bit for bit what the publisher sent, through every network and mirror in between. If they differ, delete it and fetch it again. It is the simplest security habit in computing, and it takes under a minute.