To investigate microdosimetry properties of 160 MeV/u protons and 290 MeV/u(12)C ion beams in small volumes of diameters 10-100 nm. Energy distributions of primary particles and nuclear fragments in the beams were calculated from simulations with the general purpose code SHIELD-HIT, while energy depositions by monoenergetic ions in nanometer volumes were obtained from the event-by-event Monte Carlo track structure ion code PITS99 coupled with the electron track structure code KURBUC. The results are presented for frequencies of energy depositions in cylindrical targets of diameters 10-100 nm, dose distributions yd(y) in lineal energy y, and dose-mean lineal energies yD. For monoenergetic ions, the yD was found to increase with an increasing target size for high-linear energy transfer (LET) ions, but decrease with an increasing target size for low-LET ions. Compared to the depth dose profile of the ion beams, the maximum of the yD depth profile for the 160 MeV proton beam was located at ∼ 0.5 cm behind the Bragg peak maximum, while the yD peak of the 290 MeV/u (12)C beam coincided well with the peak of the absorbed dose profile. Differences between the yD and dose-averaged linear energy transfer (LETD) were large in the proton beam for both target volumes studied, and in the (12)C beam for the 10 nm diameter cylindrical volumes. The yD determined for 100 nm diameter cylindrical volumes in the (12)C beam was approximately equal to the LETD. The contributions from secondary particles to the yD of the beams are presented, including the contributions from secondary protons in the proton beam and from fragments with atomic number Z = 1-6 in the (12)C beam. The present investigation provides an insight into differences in energy depositions in subcellular-size volumes when irradiated by proton and carbon ion beams. The results are useful for characterizing ion beams of practical importance for biophysical modeling of radiation-induced DNA damage response and repair in the depth profiles of protons and carbon ions used in radiotherapy.