Expresses that a second action happens the very instant the first begins — before the first is even fully finished. It emphasizes near-simultaneity, as if the two events overlap. Use it for something happening 'no sooner than' another, often with a sense of surprise at how quickly the second event followed.
[Verb dictionary form] + か + [same Verb ない-form] + かのうちに
ベルが鳴るか鳴らないかのうちに、生徒たちは教室を飛び出した。
Beru ga naru ka naranai ka no uchi ni, seitotachi wa kyoushitsu o tobidashita.
The students dashed out of the classroom the instant the bell rang.
鳴る (ring) か 鳴らない かのうちに — the running-out happened right as the bell rang, almost before it finished.
彼は席に着くか着かないかのうちに、もう寝てしまった。
Kare wa seki ni tsuku ka tsukanai ka no uchi ni, mou nete shimatta.
He fell asleep the moment he sat down.
着く (sit) か 着かない かのうちに marks the split second of sitting down.
映画が終わるか終わらないかのうちに、彼女は泣き出した。
Eiga ga owaru ka owaranai ka no uchi ni, kanojo wa nakidashita.
She burst into tears just as the movie was ending.
終わる (end) か 終わらない かのうちに — the crying came right at the edge of the ending.
• Uses the same verb repeated: dictionary form + か + ない-form + か. • The main clause is normally in the past tense, describing a sudden follow-up event. • Register: slightly literary/written; common in narration. • Cannot be used for your own planned or willed actions — it describes spontaneous, observed events.
The JLPT rarely asks whether you recognise a pattern — it asks which of several similar patterns fits. These are the ones ~か~ないかのうちに is tested against.
たとたん means B happened right after A fully completed; か~ないかのうちに stresses that B started before A even finished — even faster/more overlapping.
やいなや is more formal/literary and simply means 'as soon as'; か~ないかのうちに adds the nuance of 'barely even done' with slight surprise.
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.