Samsung Galaxy S5 can be rooted by flashing the CF-Auto-Root package using Odin. The tool will install SuperSU on your device before restoring the stock recovery to allow you to gain root access on your smartphone in a just a few minutes.
The source link below has the instructions and the necessary tools to root your Galaxy S5. Before continuing please keep in mind that rooting or flashing ROMs involves some risk and would usually void your warranty. So, continue with the process only if you are sure about what you are doing.
To date, this method works on the following variants:
SM-G900F (International Qualcomm)
SM-G900H (International Exynos)
SM-G900I (Oceania)
SM-G900M (Middle and South America)
SM-G900R4 (US Cellular)
SM-G900T (T-Mobile US)
SM-G900P (Sprint)
SM-G900T1 (Metro PCS)
SM-G900W8 (Canada)
[SM-G900F] CF-Auto-Root - xda-developers
The source link below has the instructions and the necessary tools to root your Galaxy S5. Before continuing please keep in mind that rooting or flashing ROMs involves some risk and would usually void your warranty. So, continue with the process only if you are sure about what you are doing.
To date, this method works on the following variants:
SM-G900F (International Qualcomm)
SM-G900H (International Exynos)
SM-G900I (Oceania)
SM-G900M (Middle and South America)
SM-G900R4 (US Cellular)
SM-G900T (T-Mobile US)
SM-G900P (Sprint)
SM-G900T1 (Metro PCS)
SM-G900W8 (Canada)
[SM-G900F] CF-Auto-Root - xda-developers