How to delete Apex class?

As Phil said - it's not possible to delete Apex Classes with Change Sets.

However, I would really recommend you to use Workbench here, it's very straightforward. All you need to do is to create just two files:


<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="">


<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="">

And then compress them to the ZIP archive with a name of package.


  1. Go to
  2. Log in using your credentials
  3. Point your mouse to Migration -> Deploy
  4. Choose your ZIP file
  5. Check Rollback On Error and Single Package checkboxes
  6. Click Next.

And if there were no errors due to some dependencies you have your Apex classes deleted.

Change Sets cannot be used to delete components. You have the option to use a destructive changes file in a deployment, as discussed here. To do this you need to ensure that any references to the class to be deleted have already been removed in a previous change set/deployment. This means the deletion is actually a multi-step activity; you can't do everything in one go.

Note that the class's meta XML includes the "status" setting for the class. You can set this to "Deleted" as part of your change set definition and this might do what you want without the need to use a destructive changes file (again, assuming all reference to the class has already been removed in a previous change set).