CubeSats are becoming increasingly popular in the scientific community. While they provide a whole new range of opportunities for space exploration, they also come with their own challenges. One of the main concerns is the negative impact which they can have in the space debris problem. Commonly lacking from attitude determination and propulsion capabilities, it has been difficult to provide CubeSats with means for active deorbiting. While electric propulsion technology has been emerging for its application in CubeSats, little or no literature is available on methods to enable it to be used for deorbiting purposes, especially within the tight constraints faced by these nanosatellites. We present a new and simple algorithm for CubeSat deorbiting, which proposes the use of novel electric propulsion technology with minimum sensing and actuation capabilities. The algorithm is divided into two stages: a spin-stabilization control; and a deorbiting-phase detection. The spin-stabilization control is inspired by the B-dot controller. It does not require gyroscopes, but only requires magnetometers and magnetorquers as sensors and actuators, respectively. The deorbiting-phase detection is activated once the satellite is spin-stabilized. The algorithm can be easily implementable as it does not require any attitude information other than the orbital information, e.g., from the Global Positioning System receiver, which could be easily installed in CubeSats. The effectiveness of each part of the algorithms is validated through numerical simulations. The proposed algorithms outperform the existing approaches such as deorbiting sails, inflatable structures, and electrodynamic tethers in terms of deorbiting times. Stability and robustness analysis are also provided. The proposed algorithm is ready to be implemented with minimal effort and provides a robust solution to the space junk mitigation efforts.