Yes, egg boxes can be composted.
They’re a good addition to a heap, especially one that is heavy with “greens“- the structure of the cardboard can heap aerate a heavy heap and the cardboard can help soak up excess moisture.
They do need some moisture to break down though – if your heap is dry, splosh some water on them and/or tear them up if you want them to rot down quicker.
Also see: if you’d prefer to reuse them instead of composting them, see “how can I reuse or recycle egg boxes? on Recycle This for ideas.