Explaining why you haven’t worked in several months or years can be uncomfortable. But it happens, and a good company will understand. There are many reasons for having a gap in employment, like raising children, medical issues, starting a new career or going back to school.
You don’t need to explain your situation in detail. Briefly say what you were doing, and then affirm that your time away from work has ended, and you’re fully ready to get back to work. Mention any relevant new skills you picked up during your employment gap. Did you take any courses or read any books?
If you’ve been laid off and had a rough time finding work, don’t say that. Spin it and say you’ve been very selective about the kind of company you want to work for, and you think you’ve found the one where its culture and values line up with yours.
Don’t dwell on this subject. Use clear language and move on.