Prokaryotes mostly lack membranous compartments that are typical of eukaryotic cells, but instead, they have various protein-based organelles. These include bacterial microcompartments like the carboxysome and the virus-like nanocompartment encapsulin. Encapsulins have an adaptable mechanism for enzyme packaging, which makes it an attractive platform to carry a foreign protein cargo. Here we investigate the assembly pathways and mechanical properties of the cargo-free and cargo-loaded nanocompartments, using a combination of native mass spectrometry, atomic force microscopy and multiscale computational molecular modeling. We show that encapsulin dimers assemble into rigid single-enzyme bacterial containers. Moreover, we demonstrate that cargo encapsulation has a mechanical impact on the shell. The structural similarity of encapsulins to virus capsids is reflected in their mechanical properties. With these robust mechanical properties encapsulins provide a suitable platform for the development of nanotechnological applications.