Skip to main content
KalkuNet

Linux Swap Size Calculator (Red Hat & Fedora Guidance)

Swap size from RAM, with or without hibernation, by the Red Hat Enterprise Linux and Fedora recommendation table.

Calculated in your browserServer & Storage
GB
GB
The memory all your programs use at their busiest.
Recommended swap
4 GB
Red Hat table row
More than 8 GB, up to 64 GB of RAM
Without hibernation
at least 4 GB
With hibernation
24 GB (1.5 × RAM)
Memory need beyond RAM that swap must cover
4 GB

Formula and sources

Red Hat Enterprise Linux table (also used by Fedora) — swap / swap allowing hibernation: RAM ≤ 2 GB: 2 × RAM / 3 × RAM RAM > 2–8 GB: equal to RAM / 2 × RAM RAM > 8–64 GB: at least 4 GB / 1.5 × RAM RAM > 64 GB: at least 4 GB / hibernation not recommended Need beyond RAM = peak memory the programs need − RAM

When to use the Linux Swap Size

  • The Red Hat and Fedora table

    Red Hat Enterprise Linux recommends swap by RAM size, and Fedora uses the same table: 2 × RAM for 2 GB or less, equal to RAM for more than 2 up to 8 GB, and at least 4 GB above 8 GB.

  • Hibernation needs more swap

    Hibernation writes the memory to swap, so the figures grow: 3 × RAM, 2 × RAM, then 1.5 × RAM for up to 64 GB. Above 64 GB, Red Hat does not recommend hibernation.

  • Swap follows the workload

    Red Hat stresses that swap size depends on the memory workload, not just on the RAM size. Enter your programs' peak memory need to see how much swap must cover when the RAM falls short.

  • Servers rarely hibernate

    Servers do not hibernate, so swap is only a cushion when memory is under pressure. Very large swap on a server can make the system crawl before the memory-hungry process is stopped.

Frequently asked questions

What about exactly 2, 8 or 64 GB?

At the borders Red Hat leaves the choice to you. The calculator uses the lower row, for example 8 GB counts as equal to RAM, and shows a warning so you can choose by your workload.

Swap partition or swap file?

Both work and are enabled the same way. A swap file is easier to resize without repartitioning.

What about zram?

zram creates compressed swap inside RAM and is often given a higher priority than disk swap. Hibernation cannot be written to zram swap, so you still need disk swap to hibernate.

Related calculators