Nanostructured Pt-based alloys show great promise, not only for catalysis but also in medical and magnetic applications. To extend the properties of this class of materials, we have developed a means of synthesizing Pt and Pt-based alloy nanoclusters in the capsid of a virus. Pure Pt and Pt-alloy nanoclusters are formed through the chemical reduction of [PtCl4]− by NaBH4 with/without additional metal ions (Co or Fe). The opening and closing of the ion channels in the virus capsid were controlled by changing the pH and ionic strength of the solution. The size of the nanoclusters is limited to 18 nm by the internal diameter of the capsid. Their magnetic properties suggest potential applications in hyperthermia for the Co–Pt and Fe–Pt magnetic alloy nanoclusters. This study introduces a new way to fabricate size-restricted nanoclusters using virus capsid.