Yes, you can compost broccoli.
Broccoli heads and leaves compost down pretty quickly. The stalk tends to take a lot longer – cut it into small chunks if you want it to rot down in a more timely fashion.
Before you compost the stalk though, did you know you can eat it? It seems to be something we’ve forgotten in the UK but you slice it into stripes and stir-fry it, or turn it into coleslaw, or make it into a tasty mash it.
Broccoli heads, stalks & leaves are all “greens“: if you’ve got a LOT, add alongside “browns” (like dried leaves or cardboard) to keep the compost heap balanced. (Balanced heaps will compost down faster.)