Transformerless grid-connected inverters are widely applied due to their low cost and small volume. But the dc current injection (DCI) is one of the main problems that need to be solved. It is difficult to measure milliamperes dc current mixed in large (≥10 A peak) ac current, which causes it difficult to suppress the DCI using the ordinary current sensor (CS). To solve this problem, a novel CS is proposed. It uses a current transformer (CT), a power amplifier, and an additional winding to cancel the ac magnetic field in a commercial current sensor (CCS). Under this circumstance, the CCS is used to detect the remaining small dc magnetic fields. As the range of CCS does not need to be large, the dc current measurement error is significantly reduced. Meanwhile, the CT can measure the ac current and provide feedback to control the inverter. In this way, the proposed CS can replace the original CS instead of adding a new CS to the inverter, which relatively reduces the cost. The volume of CT is relatively small; hence, the CT can be integrated with the CCS, which achieves a relatively small volume of the sensor. A dc current suppression experiment using a 1.5-kVA transformerless grid-connected inverter verified the effectiveness of the proposed technique.