Peacocks, Small Tortoiseshells, and Red Admirals all hibernate in buildings from mid autumn until it warms up in the spring (they are often also seen flying and basking outside on warm, sunny winter days).
If you find one in you house resting with its wings together (looking like a dead leaf) then simply leave it be. If it is somewhere inconvenient then gently move one finger underneath it (from the head end) and equally gently place it somewhere out of the way in the same room.
If a butterfly is active in your house (generally on warm winter days) then make a weak solution of honey (no more than 5% honey), soak some cotton wool with the solution and put it on your windowsill. Don’t worry if the butterfly doesn’t feed, it knows what it needs and will feed if it wants to.
If you open a window then the butterfly will come to no harm if it gets out (it will find somewhere else to complete its hibernation). It may not leave, in which case continue leaving food out on warm days and enjoy your winter lodger!
Butterflies are very good at finding ways out in the spring, but feel free to open windows to help them on their journey.
These butterflies will now become sexually mature, mate and lay eggs that will become butterflies in the summer. Peacocks have one generation (your butterfly will be the parent of some of the butterflies hibernating in houses next winter), Small Tortoiseshells have two generations, so it’s the grandchildren who will hibernate next winter.