〜なければなりません vs 〜なくてもいいです: 'must' vs 'don't have to'
Use 〜なければなりません or 〜ないといけません for something required, 〜なくてもいいです for something optional, and 〜てはいけません for something forbidden.

In short
Use 〜なければなりません or 〜ないといけません for something required, 〜なくてもいいです for something optional, and 〜てはいけません for something forbidden.
Imagine borrowing a study room at a university. Three different notices tell you what to do, what you can skip and what you must not do. In English “must not” and “do not have to” both contain a negative, but the negative works in completely different places in Japanese.
予約しなければなりません。You must make a reservation.
Focus: An obligation
Negative form minus い + ければなりません
名前を書かなければなりません。 — You must write your name.
予約しなくてもいいです。You do not have to make a reservation.
Focus: An optional action
Negative form minus い + くてもいいです
名前を書かなくてもいいです。 — You do not have to write your name.
予約してはいけません。You must not make a reservation.
Focus: A prohibition
て-form + はいけません
ここで写真を撮ってはいけません。 — You must not take photos here.
Build from the negative form
| Negative | Obligation | No obligation |
|---|---|---|
| 行かない | 行かなければなりません | 行かなくてもいいです |
| 食べない | 食べなければなりません | 食べなくてもいいです |
| しない | しなければなりません | しなくてもいいです |
| 来ない | 来なければなりません | 来なくてもいいです |
九時までに来ないといけません。
丁寧語 politeI have to come by nine.
Keep the whole negative form before といけません. The deadline uses までに, not まで.
もう帰らなきゃ。
普通体 plainI have to go home now.
Short for 帰らなければ with the obligation understood. Casual 帰らなくちゃ works similarly.
The longer なければなりません works well for clear instructions and formal explanations. The version ending in ないといけません is common in conversation. The short versions omit the final judgment that failing to do the action would be a problem. In a formal announcement keep the full form.