Git Object Hash Calculator

Calculate the SHA-1 git blob/tree/commit hash for text

Ad placeholder (leaderboard)

The git object hash calculator reproduces the exact SHA-1 identifier that git assigns to an object. Git does not hash file content directly: it first wraps the content in a tiny header, then hashes header-plus-content. This tool builds that header and runs SHA-1 so you get the same 40-character hash as git hash-object.

How it works

Every git object is stored as the bytes type SP length NUL content, where type is blob, tree, commit or tag, SP is a space, length is the decimal byte length of the content, and NUL is a single zero byte (\0). Git computes the SHA-1 of that whole sequence and uses the hex digest as the object’s name.

For example, an empty blob has content of length 0, so the hashed bytes are blob 0\0 — which always produces e69de29bb2d1d6434b8b29ae775ad8c2e48c5391, a hash any git user has seen. The calculator encodes your text as UTF-8 to get the byte length, prepends the header, and runs a self-contained SHA-1 implementation so the result is deterministic and offline.

Example

Content: "hello\n"  (6 bytes)
Header:  blob 6\0
SHA-1 of header+content = ce013625030ba8dba906f756967f9e9ca394464a

That is exactly what printf 'hello\n' | git hash-object --stdin returns.

Notes

Byte length, not character count, drives the header — multi-byte UTF-8 characters and trailing newlines change it, so paste the content precisely. The blob type covers file hashing; commit and tag reproduce those object hashes from their canonical body text. Everything runs locally; your content is never uploaded.

Ad placeholder (rectangle)