Tecnología

Git Repo Size Calculator

Estimate your Git repository size from commits, files, and average file size. See the working tree, the .git/ store, the total in MB, and a reference table.

🗓️ Updated June 2026 Reviewed by
Calculator Free · Private
Reviewed by: (editorial policy ) · Last reviewed:
Have a website? Embed this calculator for free Free — copy the code and paste it on your website Embed on your site
<iframe src="https://hacecuentas.com/embed/git-repo-size-calculator" width="100%" height="560" style="border:1px solid #e2e8f0;border-radius:12px;max-width:720px" loading="lazy" title="Git Repo Size Calculator"></iframe>
<p style="font-size:13px;text-align:center;margin:8px 0">Powered by <a href="https://hacecuentas.com" target="_blank" rel="noopener">Hacé Cuentas</a> — <a href="https://hacecuentas.com/git-repo-size-calculator" target="_blank" rel="noopener">Git Repo Size Calculator</a></p>
Preview →

Paste it on your site. Keep the credit link — thanks for sharing. More widgets →

A Git repository's footprint on disk has two parts: the working tree (your checked-out files) and the .git/ object store (the full compressed history). Working-tree size is simply your file count times the average file size. The .git/ store is roughly the working tree compressed (about 60% of it for typical source code, thanks to Git's delta + zlib packing) plus a small per-commit overhead (~2 KB each for refs, trees, and metadata). This calculator turns three numbers you already know — commits, tracked files, and average KB per file — into an estimate of your total repo size, so you can forecast clone times, size CI/CD runner disks, and decide when it's time for Git LFS or a shallow clone.

When to use this calculator

  • Forecasting GitHub/GitLab storage before migrating a large monorepo to a paid tier, so you know if you'll cross the 1 GB soft limit
  • Right-sizing CI/CD runner disks: knowing a repo clones to ~2 GB lets you provision instances and avoid out-of-disk build failures
  • Deciding when to move binaries (game assets, ML weights, design files) to Git LFS instead of bloating the history
  • Estimating clone and fetch times for new team members or ephemeral build agents on slow connections
  • Planning a git filter-repo or BFG cleanup by quantifying how much history depth and large blobs add to the .git/ folder

Git Repo Size Estimates by Profile (Formula: Working Tree = Files × Avg KB; .git/ = Working Tree × 0.6 + Commits × 2 KB)

Repo profileCommitsFilesAvg file sizeWorking tree`.git/` storeTotal estimated
Small hobby project2008015 KB1.2 MB1.1 MB~2.3 MB
Mid-size web app1,000500120 KB58.6 MB37.1 MB~96 MB
Documentation / Markdown site3,0001,2008 KB9.4 MB11.4 MB~21 MB
Large OSS project50,0003,50040 KB136.7 MB179.7 MB~316 MB
Monorepo with binaries5,00010,000500 KB4,883 MB2,939 MB~7.6 GB ⚠️
ML repo with model weights30020080,000 KB15.3 GB9.2 GB~24 GB ⚠️

Fuente: Git SCM – Git Internals: Packfiles (git-scm.com) y GitHub Docs – Repository limits (docs.github.com). ⚠️ GitHub recomienda mantener repositorios bajo 1 GB, aconseja fuertemente no superar 5 GB, y bloquea archivos individuales mayores a 100 MiB sin Git LFS. Los repos con binarios (PNG, ZIP, modelos ML) no se benefician de la compresión delta; el factor 0.6 puede subestimar el tamaño real del .git/ en esos casos.

How it works

How It's Calculated

Git's size model has two distinct components: the working tree (your checked-out files) and the .git/ object store (the compressed history). This calculator estimates both:

Working Tree (KB)   = Files × Avg_KB_per_File

.git/ Store (KB)    = Working Tree × 0.6  +  Commits × 2 KB
                      └─ packed snapshot ─┘   └─ per-commit overhead ┘

Total (KB)          = Working Tree + .git/ Store
Total (MB)          = Total (KB) / 1024

Why 0.6? Git stores objects with zlib deflate compression and delta encoding between similar blobs. On plain-text source code this typically lands the packed history at roughly 50–65% of the raw working-tree size, so 0.6 is a good default for code-heavy repos. The +2 KB per commit term accounts for the commit object, its tree objects, and ref/metadata overhead.

When to adjust the factor (mentally):

  • Text-heavy repos (TypeScript, Python, Markdown): the real .git/ factor can be even lower, 0.3–0.5, because delta compression is extremely effective.

  • Binary-heavy repos (PNG, JPEG, ZIP, MP4, .pt/.safetensors model files): Git cannot delta-compress already-compressed formats, so the factor approaches 1.0 and the history balloons. If your average file size is large, treat this estimate as a floor and plan for Git LFS.
  • ---

    Reference Table

    All rows use the calculator's formula (Working tree = Files × Avg_KB; .git/ ≈ 0.6 × working tree + 2 KB × commits):

    Repo profileCommitsFilesAvg fileWorking tree.git/ storeTotal
    Small hobby project2008015 KB1.2 MB1.1 MB~2.3 MB
    Mid-size web app1,000500120 KB58.6 MB37.1 MB~96 MB
    Documentation / Markdown site3,0001,2008 KB9.4 MB11.4 MB~21 MB
    Large OSS project50,0003,50040 KB136.7 MB179.7 MB~316 MB
    Monorepo with binaries5,00010,000500 KB4,883 MB2,939 MB~7.6 GB ⚠️
    ML repo with model weights30020080,000 KB15.3 GB9.2 GB~24 GB ⚠️

    > ⚠️ GitHub recommends keeping repositories under 1 GB, strongly recommends under 5 GB, warns on files over 50 MB, and blocks any single file over 100 MiB unless it's tracked with Git LFS.

    ---

    Worked Cases

    Case 1 — Standard SaaS web app


    1,000 commits, 500 files (TypeScript/CSS/HTML), 120 KB average.

    Working tree = 500 × 120            = 60,000 KB ≈ 58.6 MB
    .git/ store  = 60,000 × 0.6 + 1,000×2 = 38,000 KB ≈ 37.1 MB
    Total ≈ 96 MB

    Well within the free tier. A full clone takes a few seconds on broadband.

    Case 2 — Game repo with PNG assets


    300 commits, 2,000 files, 2,048 KB (2 MB) average — mostly textures.

    Working tree = 2,000 × 2,048         = 4,096,000 KB ≈ 4.0 GB
    .git/ store  = 4,096,000 × 0.6 + 600  = 2,458,200 KB ≈ 2.3 GB (real value higher — binaries don't compress)
    Total ≈ 6.3 GB (estimate); in practice often worse

    Action: move binary assets to Git LFS now. Without it, every contributor clones gigabytes of un-deltifiable data.

    Case 3 — Long-lived enterprise monorepo


    50,000 commits, 8,000 mixed files, 50 KB average.

    Working tree = 8,000 × 50             = 400,000 KB ≈ 390.6 MB
    .git/ store  = 400,000 × 0.6 + 100,000 = 340,000 KB ≈ 332 MB
    Total ≈ 723 MB

    Action: use git clone --filter=blob:none (partial clone) for CI to skip historical blobs, and run git filter-repo --analyze to find the biggest size contributors.

    ---

    How to Measure the Real Size

    The calculator gives an estimate; these commands give the truth:

    bash
    git count-objects -vH          # loose + packed object sizes
    du -sh .git/                   # actual .git/ on disk
    du -sh --exclude=.git .        # working tree only
    git gc --aggressive            # repack first for the true minimum

    On the GitHub API, GET /repos/{owner}/{repo} returns a size field in KB. On GitLab, see Settings → Usage Quotas → Storage.

    ---

    Common Mistakes

    1. Measuring only the working tree. du -sh . excludes nothing, but many devs forget that .git/ can be larger than the checked-out code. Always run du -sh .git/ separately.
    2. Assuming binaries compress like text. Git deltas source code 85–92%, but near 0% on PNG/JPEG/ZIP/.pt. Using a 0.6 factor on a binary-heavy repo underestimates .git/ by several times.
    3. Ignoring git gc state. A repo that has never been packed can be 3–5× larger than one that has. Repack before measuring.
    4. Confusing commits with snapshots. Git stores a new blob for every changed file in every commit; a repo touching 200 files per commit grows far faster than one touching 5.
    5. Forgetting tags, stashes, and PR refs. Annotated tags, stashes, and refs/pull/ refs all add objects and can inflate .git/ in busy repos.

    ---

    Related Calculators

  • Storage Unit Converter (KB, MB, GB, TB)

  • Worked example: a mid-size web app

    Inputs: 1,000 commits, 500 files, 120 KB average file size
    Working tree = 500 × 120 = 60,000 KB ≈ 58.6 MB
    .git/ store = 60,000 × 0.6 + 1,000 × 2 = 38,000 KB ≈ 37.1 MB
    Total = 60,000 + 38,000 = 98,000 KB ≈ 95.7 MB
    ≈ 96 MB on disk (well under GitHub's 1 GB soft limit)

    Frequently asked questions

    How do I estimate my Git repository size?
    Use two terms. Working tree = number of tracked files × average file size in KB. The .git/ store ≈ 0.6 × working tree (compressed history for code) + ~2 KB per commit. Add them and divide by 1,024 for MB. Example: 500 files × 120 KB = 58.6 MB working tree; .git/ = 60,000 × 0.6 + 1,000 × 2 = 37.1 MB; total ≈ 96 MB. For binary-heavy repos, raise the 0.6 factor toward 1.0.
    What is the average size of a Git repository?
    The median repository (including .git/) is roughly 10–20 MB, but the average is pulled well above 200 MB by repos with binaries or long histories. Most active professional projects with 1,000–5,000 commits and no binary assets land in the 50–300 MB range.
    Does the number of branches affect repo size?
    Barely. A branch is just a 41-byte file pointing to a commit hash. What costs storage is the unique commits and blobs on a branch that aren't reachable elsewhere. Once a branch is merged, its objects are already shared with main, so merged branches add essentially zero extra storage.
    How does Git LFS change the size calculation?
    With Git LFS, each large file becomes a ~130-byte pointer in the object store, and the real content lives on an LFS server. A 500 MB file then adds ~130 bytes per version to .git/ instead of 500 MB, so clone and fetch get dramatically faster. The working tree still receives the full file on checkout. In the formula, treat LFS-tracked files as near-zero in the .git/ term.
    Why does GitHub warn about repositories over 1 GB?
    GitHub recommends repositories stay under 1 GB and strongly recommends under 5 GB; it warns on files over 50 MB and blocks any single file over 100 MiB unless tracked with Git LFS. Large repos slow clones for everyone, raise CI costs (every runner downloads full history), and consume shared-infrastructure quota.
    What is a shallow clone and how much does it save?
    git clone --depth=1 fetches only the latest snapshot instead of full history, cutting .git/ size by up to ~99% on long-lived repos. It's ideal for CI/CD that only builds HEAD. The trade-off: you can't run git log, git blame, or git bisect across history without fetching more commits.
    How do I check my actual repo size right now?
    Run git count-objects -vH for a loose-vs-packed breakdown, du -sh .git/ for the object store, and du -sh --exclude=.git . for the working tree. On GitHub, GET /repos/{owner}/{repo} returns a size field in KB; on GitLab see Settings → Usage Quotas → Storage.
    Does `git gc` reduce repository size, and by how much?
    git gc repacks loose objects into pack files with delta + zlib compression. On a repo that was never packed, git gc --aggressive can shrink .git/ by 40–70% for text-heavy code and 10–30% for binaries. Git auto-runs a light git gc --auto once loose objects exceed about 6,700.
    Why is my .git/ folder bigger than my actual code?
    Because .git/ stores every version of every changed file, not just the current snapshot. A long history with many edits, plus large binaries that were committed once and later deleted (they stay in history forever), can make .git/ several times larger than the working tree. Use git filter-repo --analyze to find the biggest historical blobs.
    What compression does Git use internally?
    Git compresses individual objects with zlib deflate (the ZIP/gzip algorithm), reaching roughly 60–75% reduction on plain-text source. For pack files it additionally applies delta encoding (binary diffs between similar blobs) before zlib. That delta + zlib combination is why text repos shrink dramatically while already-compressed binaries barely shrink at all.

    Methodology & trust

    Editorial

    Calculadora de tecnología revisada por el equipo editorial de Hacé Cuentas, contrastada con Git SCM – Git Internals: Packfiles (Official Documentation), según nuestra política editorial y metodología.

    Updates

    Última revisión: June 20, 2026. Los parámetros se verifican periódicamente con las fuentes citadas.

    Privacy

    Calculations run 100% in your browser. We do not store or transmit your data.

    Limitations

    Indicative results. For critical decisions, consult a professional.

    📌 How to cite this calculator

    Rodríguez, M. (2026). Git Repo Size Calculator. Hacé Cuentas. https://hacecuentas.com/git-repo-size-calculator

    Contenido bajo licencia CC-BY 4.0 — reutilizable citando la fuente con enlace a Hacé Cuentas.

    ✉️ Reportar un error en esta calculadora