Yes, you can compost cardboard – in fact, it’s a very useful addition to a garden compost heap.
Corrugated cardboard typically adds bulk to your compost, helps preserve the necessary air flow and soaks up excess moisture too. (Other raw fibreboard items like egg boxes or toilet roll tubes work in the same way.)
In composting terms, it’s a brown item: make sure you add it alongside fresh greens – like kitchen scraps or garden cuttings – to your compost heap balanced and as it sucks up moisture, add extra liquid if your compost pile has a tendency to be on the dry side. (Cardboard rots down much quicker if it’s wet and torn into small pieces – tearing it up is easier if it’s damp too.)
A couple of warnings though: do peel off any plastic packaging tape/document pockets as they won’t compost and be careful when composting shiny cardboards – that shininess is often the result of a plastic coating or using other synthetic materials.