Hash Calculator

Generate cryptographic hashes using MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, and HMAC algorithms

Tool Overview

The Hash Calculator is a free online tool that allows you to generate cryptographic hash values for any input text. It supports a wide range of hash algorithms including MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, and their HMAC variants. All calculations are performed locally in your browser using the Web Crypto API, ensuring your data never leaves your device.

Go to Tool

How It Works

The Hash Calculator leverages the Web Crypto API to compute cryptographic hashes and HMAC signatures.

Cryptographic Hash Functions

Cryptographic hash functions take an arbitrary amount of data as input and produce a fixed-size string of characters (the hash) as output. They possess several key properties:

  • Deterministic: The same input will always produce the same hash output
  • Fast Computation: Hash functions compute quickly for any input size
  • Pre-image Resistance: Given a hash value, it should be computationally infeasible to determine the original input
  • Collision Resistance: It should be infeasible to find two different inputs that produce the same hash
  • Avalanche Effect: A small change in the input should produce a significant change in the hash output
  • Fixed Output Size: Regardless of input size, the hash output has a fixed length

Supported Algorithms

  • MD5 - 128-bit hash (32 characters). Widely used for checksums but considered insecure for cryptographic purposes
  • SHA-1 - 160-bit hash (40 characters). No longer collision-resistant
  • SHA-224 - 224-bit hash (56 characters). Truncated version of SHA-256
  • SHA-256 - 256-bit hash (64 characters). Currently recommended for most security applications
  • SHA-384 - 384-bit hash (96 characters). Truncated version of SHA-512
  • SHA-512 - 512-bit hash (128 characters). Provides higher security margin
  • HMAC variants - Keyed-hash message authentication codes requiring a secret key

HMAC (Hash-based Message Authentication Code)

HMAC combines a cryptographic hash function with a secret key to provide message authentication. It ensures both data integrity and authenticity. The recipient must know the secret key to verify the HMAC.

Processing Flow

  1. Input Encoding: The input text is encoded using UTF-8
  2. Hash Computation: For standard hash algorithms, SubtleCrypto.digest() is used. For HMAC, SubtleCrypto.sign() with an imported key is used
  3. Hexadecimal Conversion: The raw byte array output is converted to a hexadecimal string for readability

Features

  • Support for MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 hash algorithms
  • HMAC variants for all supported algorithms
  • Secret key input for HMAC algorithms
  • Copy result to clipboard with one click
  • Clear all inputs with a single button
  • Auto-detection of hash length
  • Offline support - works without internet connection
  • No data stored on servers - complete privacy

Usage Examples

Example 1: Basic SHA-256 Hash

Input:

Hello, World!

Algorithm: SHA-256

Output:

dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f

Example 2: MD5 Checksum

Input:

test string

Algorithm: MD5

Output:

6f8db599de986fab7a21625b7916589c

Example 3: HMAC-SHA256

Input:

message to authenticate

Algorithm: HMAC-SHA256

Secret Key:

my-secret-key

Output:

fb48bafce168a0e9ae39d207c682f4a1f91c6c01100402fbee99eb9c52981906

FAQ

What is a cryptographic hash function?

A cryptographic hash function is an algorithm that takes an arbitrary amount of data as input and produces a fixed-size string of characters (the hash) as output. It is designed to be one-way, meaning it's easy to compute the hash from the input but computationally infeasible to reverse the process.

Which hash algorithm should I use?

For most security applications, SHA-256 is the recommended choice. SHA-512 provides higher security but produces longer hashes. MD5 and SHA-1 are only suitable for non-security purposes like checksums. For message authentication, use HMAC with SHA-256 or SHA-512.

What is HMAC?

HMAC (Hash-based Message Authentication Code) is a mechanism for verifying the integrity and authenticity of a message. It combines a cryptographic hash function with a secret key. The recipient must know the secret key to verify the HMAC, ensuring the message hasn't been tampered with and came from a trusted source.

Is my data safe?

Yes, all hash calculations are performed locally in your browser using the Web Crypto API. Your input text and secret key never leave your device or get sent to any server.

Can I use this tool offline?

Yes, once the page is loaded, the Hash Calculator works completely offline. All computations are done in the browser.