Yes. Bread composts quickly and is a decent green. The catch is that it is cooked food, so it attracts rodents and can go mouldy in an unpleasant way if left sitting on the surface. Below: whether you can compost bread, why, how much to add, and the mistakes that cause trouble.
Bread is mostly starch: readily available energy for microbes, which is why it breaks down fast and can heat a pile noticeably.
Break it up and bury it under at least 10cm of other material. Small quantities only. Stale bread is better than mouldy bread only in that it is less unpleasant to handle; both compost fine.
Leaving it on top. An open invitation to rats and gulls.
Adding large amounts, particularly oily or buttered bread, which behaves more like fat than starch.
Perfectly fine. The mould is already doing what your pile does, and the species involved are common environmental fungi. Handle it with the same care you would any dusty mouldy material. Do not shake it around indoors, and if you are asthmatic, wear a mask.
Energy density. A slice of bread carries far more available calories per gram than a carrot peeling, and rodents are efficient about where they spend effort. This is why bread sits in the caution column while vegetable waste does not.
Butter, oil, mayonnaise: now it behaves like fat. Small smears are irrelevant; a buttered sandwich is not. Fats coat particles, repel water and go rancid rather than composting.
Cheese or meat fillings: treat as meat and dairy, keep out of a domestic pile.
Plain, stale, dry: the easy case. Break it up and bury it.
A few slices scattered and buried is nothing. Half a loaf in one spot creates a dense starchy mass that goes slimy and anaerobic before microbes work through it. Break it up and spread it.
More materials in the material library. New to this? How to compost.
Independent sources worth reading alongside this page: EPA, Composting at Home · Cornell Waste Management Institute.