Some Magento 2 extensions may be no longer in use in your store. Reasons for that can vary. Some modules become irrelevant over time or there may be some crucial functionality lacking. That's why you might want to uninstall Magento 2 extension.

There are two methods for removing modules in Magento. You can either uninstall an extension manually or via composer. Let's have a look at each of them in more detail. 

Uninstall Magento 2 Extension via Composer

To uninstall Magento 2 module located in the vendor/vendor-name/module-name folder:

1. Connect to the root folder of your Magento via SSH.

2. Find the extension you want to remove using the following command:

php bin/magento module:status

3. Disable the extension:

php bin/magento module:disable <ExtensionProvider_ExtensionName> --clear-static-content
php bin/magento setup:upgrade

4. Go to your composer.json file to find the composer name of the extension and then uninstall it:

composer remove vendor-name/module-name

5. Run setup CLI commands:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

Note: if you don't want your website to be down during deployment, try these zero downtime deployment commands for Magento 2.

Uninstall Magento 2 Extension Manually

If the Magento module you want to remove is located in the app/code/VendorName/ModuleName folder, refer to the following steps:

1. Use SSH to connect to the root folder of your Magento.

2. Run the following command:

php bin/magento module:status

and find the internal name of the extension you want to uninstall.

3. Disable the extension

php bin/magento module:disable <ExtensionProvider_ExtensionName> --clear-static-content
php bin/magento setup:upgrade

4. Remove Magento module files:

cd app/code/<ExtensionProvider>/
rm -rf <ExtensionName>

Note: some of the extensions of the same vendor can be interdependent. Some extensions might serve as a basis for other modules of the same vendor. So you need to check these dependencies out before uninstalling Magento extensions and backup your Magento.

This is how you can remove an extension in Magento 2. Just choose the method that suits your particular case better and make sure to follow the guidelines carefully.