Skip to main content

Deleting a canister

Beginner
Management

If you want to permanently delete a specific canister or all canisters for a project, you can use the dfx canister delete <canister-name> command.

Deleting a canister permanently removes its code and state. This action cannot be undone, and once the canister is deleted, its ID cannot be reused. Before you can delete a canister, you must first stop the canister using dfx canister stop <canister-name> to clear any pending message requests or replies.

Deleting a canister will withdraw any cycles from that canister and return them to the cycles wallet or cycles ledger account associated with the canister's controller principal. If the canister has multiple controllers, then the principal that made the delete request receives the cycles.

Common errors related to canister deletion include: