We consider a one dimensional storage system where each container can store a bounded amount of capacity as well as a bounded number of items k ≥ 2. This defines the (standard) bin packing problem with cardinality constraints which is an important version of bin packing, introduced by Krause, Shen and Schwetman already in 1975. Following previous work on the unbounded space online problem, we establish the exact best competitive ratio for bounded space online algorithms for every value of k. This competitive ratio is a strictly increasing function of k which tends to Π∞ + 1 ≈ 2.69103 for large k. Lee and Lee showed in 1985 that the best possible competitive ratio for online bounded space algorithms for the classical bin packing problem is the sum of a series, and tends to Π∞ as the allowed space (number of open bins) tends to infinity. We further design optimal online bounded space algorithms for variable sized bin packing, where each allowed bin size may have a distinct c...