んです and のです: explain a situation
Connect a statement to the situation or a listener’s question. This is an explanatory form, not simply a longer polite ending.
Attach the form to a plain clause
Use forms such as 行くんです, 行かないんです, and 行ったんです. のです belongs to the same construction; んです is common in conversation.
Present affirmative nouns and na-adjectives take な: 学生なんです and 静かなんです. Use な rather than making 学生だんです.
Read the connection to the preceding situation
When asked why you are leaving early, 明日は朝が早いんです。 explains that you have an early start tomorrow. Read it together with the situation it answers.
財布をなくしたんです。 can introduce the problem that you lost your wallet. んです does not always correspond to an explicit ‘because’ inside the sentence.
An explanatory question can be quite direct
どうして帰るんですか。 asks for an explanation of why someone is leaving. Depending on tone and relationship, it can sound challenging.
Separate a simple factual question from a request for an explanation. Use んです where that connection helps, and consider whether asking for someone’s reasons is appropriate.
Quick check: How do you explain that you are a student using 学生 and んです?
Show the answer and why
学生なんです. A present affirmative noun connects with な. For the past, attach the ending to the past plain form: 学生だったんです.

