Git Blob Hash Calculator

Work out the Git blob hash of any text. This is the SHA-1 ID that Git gives a file with exactly these contents, so you can check what Git will store for it.

1 Paste or type your text

2 Your answer

Your answer shows here as you type.

How to use the Git Blob Hash Calculator

  1. Paste the exact contents of the file into the box.
  2. Include line endings and any trailing newline, since they change the hash.
  3. Copy the Git blob hash from the result.

Frequently asked questions

What is a Git blob hash?

It is the SHA-1 hash of the string "blob", a space, the byte length of the content, a zero byte, and then the content itself. Git uses it as the object ID for a file's contents.

Why does adding a newline change the hash?

The hash covers every byte of the content, so one extra newline changes the input and gives a different SHA-1 value.

Will this match git hash-object?

Yes, for the same bytes. Git hashes the file as stored, so CRLF line endings from Windows give a different hash from LF line endings.

Does this work for SHA-256 Git repositories?

No. This tool gives the SHA-1 object ID used by default. Repositories created with the SHA-256 object format use a different hash.

Wrote something with AI? Slop Monkey rewrites it so it sounds like you, and keeps your facts.