Means 'there is no choice but to' or 'can only' — the situation leaves no other option. It expresses reluctant acceptance of the only remaining course of action. Often the fuller form 〜より(ほか)ない or 〜ほか(は)ない is used. It has a resigned, somewhat formal tone.
[Verb dictionary form] + ほかない/ほかはない (also より(ほか)ない)
電車が止まったので、歩いて帰るほかない。
Densha ga tomatta node, aruite kaeru hoka nai.
Since the trains stopped, I have no choice but to walk home.
歩いて帰る + ほかない = the only option left
誰も手伝ってくれないなら、一人でやるほかはない。
Dare mo tetsudatte kurenai nara, hitori de yaru hoka wa nai.
If no one will help, I have no choice but to do it alone.
やるほかはない expresses reluctant acceptance of the only choice
こうなっては、あきらめるほかない。
Kou natte wa, akirameru hoka nai.
Now that it's come to this, there's nothing to do but give up.
あきらめるほかない shows resignation to the sole remaining option
• Uses the verb DICTIONARY form + ほか(は)ない. • Nuance: reluctant, resigned acceptance of the only option. • Related forms: 〜よりほかない, 〜しかない (more common in speech).
The JLPT rarely asks whether you recognise a pattern — it asks which of several similar patterns fits. These are the ones ~ほかない/~ほかはない is tested against.
しかない has the same 'no choice but to' meaning and is more common/casual; ほかない is slightly more formal or written.
ざるを得ない ('cannot help but') stresses being forced against one's will and is more formal; ほかない emphasizes there being no other option available.
Study Japanese grammar on LenGaki

Get the Android app
The app adds offline study, home-screen widgets, stroke-order tracing, speaking practice with pronunciation scoring, and an AI tutor that answers questions in context — none of which fits in a browser tab.