How to deal with an irritable boyfriend ?

My bf and I have been together for 2 years and just recently he is ALWAYS so grumpy and irritated. I haven’t done anything wrong but even the slightest things make him irrationally angry. He reassures me that I haven’t done anything but continues to be this way. We can be having a simple conversation and i can say something with no attitude and he takes it as me being rude/having an attitude & just becomes downright awful. It makes me feel so alone and like I’m walking on eggshells. His fam isnt that great most of the time which could be the cause, but my question is how do i even try to deal with it??? When i try communicating it is me “being on his back”. He is very defensive about it.