But is a coordinating conjunction. You use but to join two ideas or statements. The second idea or statement usually contrasts the first one in some way.
- I don't know his address, but my wife does.
- I invited her to the party, but she politely refused.
- We tried our best, but we couldn't do it.
- My computer is very old, but it works properly.
You can use but after an expression of apology to introduce a statement or question politely.
- I'm sorry, but I can't promise anything.
- Excuse me, but may I say something?
- Excuse me, but I don't think so.
- Forgive me for asking, but why did you divorced your husband?
But can be used between repeated words to give more importance to a word or statement.
- Everyone, but everyone knows the truth.
- Nobody, but nobody couldn't stop him.
But is used after words such as 'nobody', 'everything' or 'anything' to mean except.
- Everyone but Bob has finished eating.
- No one but me knows what it means.
- She's done nothing but sit around and watch television.
At the beginning of a sentence
In spoken English you can start a sentence with but to express surprise, shock, annoyance, etc.
- 'I've decided to look for a new job. 'But why?'
- But you promised not to tell anyone.
You use but for to say what prevented something from happening.
- But for heavy snow, I would have arrived earlier for the meeting. (If it weren't for the heavy snow, I'd have arrived earlier...)
Only can be used as an adverb to mean only.
- He's but [=only] a little boy!
- You can see a lot of birds in our garden: sparrows, robins and blackbirds, to name but a few.