How VLSM works
In standard classless routing (CIDR), if you divide a network, all subnets are typically the same size. If you have one branch requiring 100 hosts and three branches requiring 2 hosts each, giving everyone a /25 (126 usable hosts) wastes 124 IPs on each 2-host subnet. VLSM solves this by sorting requirements from largest to smallest and carving out precisely sized subnets (e.g. a /25 for the large branch, and /30s for the small branches) sequentially.
Rules of VLSM allocation
To avoid overlapping blocks, the network address of any allocated subnet must be evenly divisible by its block size (determined by its subnet mask). For example, a /26 subnet (block size of 64) can only start at host offsets like .0, .64, .128, or .192. This is why VLSM algorithms always sort the host requirements in descending order (largest first) before assigning IP boundaries.