Zero Signup ToolsFree browser tools

Developer Tools

Git Blob Hash Calculator

Compute the Git object id of any file content in your browser. SHA-1 and SHA-256, blob, tree, commit, and tag, with line ending and newline control. No signup.

6 chars

Object type

File contents (git hash-object). All four types use the same header framing; only the type word changes.

Line endings

Git often stores LF. Force LF to match a repo that normalizes on commit with core.autocrlf or a text attribute.

Trailing newline

A final newline is a real byte and changes the hash. Most text files end with exactly one.

Samples

Computing the object id...

Why a Git object id is not a plain hash of the file

  • Git stores each object as a header followed by content. The header is the type word (blob, tree, commit, or tag), a space, the content length in bytes, and a single NUL byte.
  • The object id is the hash of the header and the content together. A SHA-1 or SHA-256 taken over the file contents alone leaves out the header, so it never matches the id Git reports.
  • The default object format hashes with SHA-1. Repositories created with the newer object format hash with SHA-256 over the identical framing, which is why this tool shows both.
  • Line endings and the trailing newline are real bytes in the content. Converting CRLF to LF, or adding or removing a final newline, changes the bytes and therefore the object id.

How to use

  1. Paste or type the exact file contents into the box, or load a sample such as the classic hello blob.
  2. Pick the object type. Leave it on blob to match git hash-object on a file; choose tree, commit, or tag for those object kinds.
  3. If your result must match a repository, set line endings to Force LF to mirror core.autocrlf normalization, and choose whether the content ends with a trailing newline.
  4. Read the object id: the SHA-1 value is what current Git reports by default, and the SHA-256 value matches a repository using the newer object format.
  5. Use the copy buttons to copy either object id, or the framed pre-image, and check the byte breakdown to see the header, content size, and total bytes hashed.
  6. Confirm against the well-known empty blob and hello blob ids shown for reference, then run git hash-object locally to verify. The content stays in your browser and is never uploaded.

About this tool

Git Blob Hash Calculator computes the object id that Git assigns to file content, the same value git hash-object prints, entirely in your browser. Git does not name an object by a plain hash of the file. It first wraps the content in a tiny loose-object header of the form type, a space, the content length in bytes, and a single NUL byte, then hashes the header and the content together. That is why a normal SHA-1 or SHA-256 of the same text never matches the id Git reports: the header is part of the hash. This tool builds that exact pre-image and shows it to you, so the calculation is transparent rather than a black box. It supports all four loose object types, which share identical framing and differ only in the type word: blob for file contents, and tree, commit, and tag for the other objects Git stores. It computes both hash functions Git can use: SHA-1, which is the default object format, and SHA-256, which is the object id you get in a repository created with the newer SHA-256 format, computed over the byte-for-byte identical framing. Two details quietly change a blob hash and trip people up, so both are exposed as controls. Line endings: Git's core.autocrlf setting or a text attribute in .gitattributes can convert CRLF to LF before an object is written, so the committed bytes, and the hash, differ from the file on a Windows checkout. You can force LF or force CRLF to match whichever form a repository actually stores. The trailing newline: a final newline is a real byte in the content, so a file that ends with a newline hashes differently from one that does not. You can add or strip a single trailing newline to match either case. Alongside the object id, the tool shows the header string, the content byte length measured as UTF-8, the total number of bytes hashed, and a readable rendering of the full pre-image with the NUL byte marked. Two fixed, well-known object ids, the empty blob and the blob for the text hello followed by a newline, are listed for reference and are also checked automatically: when your input reproduces one of them, the tool confirms the match, so you can trust the output against any real Git install. This is a calculator and an explainer, not a Git client. It does not read a repository, write objects into one, compress them with zlib the way the on-disk loose-object format does, or resolve a hash back to content; it works only on the content you paste. Everything runs locally using TextEncoder for the bytes and the Web Crypto digest for SHA-1 and SHA-256, so the content you paste is never uploaded.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools