This article explains how to reformat your MacBook Pro using recovery mode. It includes information on how to install a fresh install of macOS afterward.
How to EASILY erase and factory reset your Mac!
If your MacBook Pro is getting slower due to age or too many applications, speed things up by reformatting the laptop. This action erases a MacBook Pro and returns it to its factory settings. Reformatting is a good idea if you plan to sell or give away your MacBook Pro.
Reformatting a MacBook Pro will erase all data on the device. Back up your MacBook before proceeding with this option. Once it’s reformatted, install a fresh copy of macOS if you’re keeping the laptop. An internet connection is required to install the new macOS.
Turn on or restart your MacBook Pro by holding down the power button and then immediately pressing and holding Command+R on your keyboard before you see the Apple logo or other startup screen. Release the keys after you see an Apple logo, spinning globe, or other startup screen. This process boots your Mac into macOS Recovery mode.