This article explains how to factory reset an Android. Instructions in this article apply to Android 10 and higher and should work no matter who made your Android phone (Samsung, Google, Huawei, Xiaomi, etc.).
Open your phone or tablet's Settings app.
Tap System > Advanced > Reset options.
You might be able to skip Advanced and go straight to Reset options.
Tap Erase all data (factory reset) > Erase all data. Enter your PIN, password, or pattern if necessary.
Select Erase all data again.
This step is the point of no return. Once you select it, the erasing process begins.
Once the erasing process is finished, set up your device and restore your backed-up data.