In a nutshell
Subnetting carves one IP network into several smaller ones. An address is 32 bits, and the subnet mask marks where the network part ends and the host part begins. Sliding that boundary one bit to the right doubles the number of subnets while halving how many hosts fit in each.