1. Studies of species' responses to microclimatic conditions have increased our understanding of their habitat requirements and possible responses to climate warming. However, little is known about the role of microclimate for insects inhabiting hollow trees.2. We explored the relationship between tree characteristics and microclimate, and analysed how the microclimate in tree-hollows affects the occurrence and body size of an endangered beetle species, Osmoderma eremita.3. We placed temperature data-loggers in wood mould (= loose material in tree-hollows) and surveyed O. eremita in 47 hollows in oak pastures in south-eastern Sweden. We found that tree characteristics previously known to be associated with occurrence of beetle species confined to tree-hollows (larger diameters, more wood mould, entrances higher up, and not directed upwards) tend to decrease moisture and moisture variation, while their effects on temperature and temperature fluctuations differ during different seasons. This indicates that microclimatic conditions are important for beetles in hollow trees, and many specialised species seem to avoid conditions that are too moist. 4. O. eremita occurred more frequently in trees with a warmer and more stable microclimate, while adult body size decreased with a warmer microclimate. A positive effect of a warmer microclimate was expected, since the study was done near the northern margin of the species' range. 5. O. eremita is confined to living in hollow trees, which may be due to the microclimate there being more stable in comparison to both the ambient climate and the microclimate in standing and downed dead wood.