Skip to content
ENExplore Calculators

Swap Size Calculator

Recommend swap partition or swap file size based on installed RAM and workload type.

About Swap Size Calculator

Swap sizing guidance varies with installed RAM. Small-memory systems (≤2GB) benefit from swap double their RAM because the OS itself needs breathing room. Mid-size systems (2-8GB) do well with swap equal to RAM. Large-memory systems (>8GB) rarely need swap proportional to RAM, so the recommendation flattens to the larger of 4GB or the square root of RAM. If hibernation (suspend-to-disk) is required, swap must be at least RAM plus a safety margin (approximated here as RAM + √RAM) since the entire RAM image is written to swap on suspend.

Formulas

Swap for RAM ≤ 2GB

swap = 2 × RAM

R
installed RAM in GB

Swap for 2GB < RAM ≤ 8GB

swap = RAM

R
installed RAM in GB

Swap for RAM > 8GB

swap = max(4, √RAM)

R
installed RAM in GB

Hibernation-safe swap

swap = RAM + √RAM

R
installed RAM in GB

Worked example

With the default values below, Swap Size Calculator returns Recommended Swap Size of 8.00. Change any input above and every figure here is recalculated in your browser.

Inputs used

Installed RAMminimum 0.25 GB
8 GB
Support Hibernation (suspend-to-disk)
No

Results

Recommended Swap Size
8.00 GB
Standard Recommendation (no hibernate)
8.00 GB
Hibernation-Safe Recommendation
10.83 GB
Rule Applied
2GB < RAM ≤ 8GB → equal to RAM

Step by step

  1. 1Values used
  2. 2Swap for RAM ≤ 2GB
  3. 3Swap for 2GB < RAM ≤ 8GB
  4. 4Swap for RAM > 8GB
  5. 5Hibernation-safe swap
  6. 6Recommended Swap Size= 8.00 GB
  7. 7Standard Recommendation (no hibernate)= 8.00 GB
  8. 8Hibernation-Safe Recommendation= 10.83 GB
  9. 9Rule Applied= 2GB < RAM ≤ 8GB → equal to RAM

Assumptions and limits

  • The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Do I need swap if I have a lot of RAM?

Some swap is still useful even with abundant RAM — it lets the kernel move rarely-used pages out of RAM and provides a safety margin against out-of-memory situations, but it no longer needs to scale linearly with RAM.

Why does hibernation need more swap?

Hibernation writes the entire contents of RAM to swap before powering off, so the swap space must be at least as large as RAM, with a small margin for kernel bookkeeping — approximated here as RAM plus its square root.

Is swap on an SSD bad for the drive's lifespan?

Modern SSDs tolerate swap well under normal desktop/server workloads; the practical concern is more about performance (swapping is much slower than RAM) than SSD wear for typical usage patterns.

Swap Size Calculator – Calculate Recommended Swap Size