Don't go by the socket size, go by the battery size.
There are M18, 18 volt, 3/8 and 1/2. I don't believe they offer the 1/2 in M12, 12 volt. M18 and M12 batteries do not interchange.
With an M12 battery tool, you may still need a breaker bar to get things loose. With an M18, you will not.