Means 'before ~ happens' or 'while ~ has not yet happened'. It signals doing something during the window before an (often undesirable) change occurs, so you act while conditions are still favorable. There is a nuance of taking advantage of the current state before it changes.
[Verb ない-form] + うちに / [い-adj negative くない] + うちに / [Noun] + でない + うちに
雨が降らないうちに帰りましょう。
Ame ga furanai uchi ni kaerimashou.
Let's go home before it starts raining.
降らない (won't rain) + うちに means acting within the window before rain begins.
忘れないうちにメモしておこう。
Wasurenai uchi ni memo shite okou.
Let me jot it down before I forget.
忘れない (not yet forget) + うちに — do it while the memory is still there.
暗くならないうちに家に着きたい。
Kuraku naranai uchi ni ie ni tsukitai.
I want to get home before it gets dark.
暗くならない (won't get dark) + うちに expresses acting before the change to darkness.
• Emphasizes acting before an unwanted or inconvenient change. • Contrast with the affirmative ~うちに ('while ~ still is'), e.g. 若いうちに. • The following clause is usually something you intend or should do.
The JLPT rarely asks whether you recognise a pattern — it asks which of several similar patterns fits. These are the ones ~ないうちに is tested against.
まえに is a neutral 'before' focused simply on sequence; ないうちに adds the nuance of acting within a closing window before an unwanted change.
Affirmative ~うちに (e.g. 明るいうちに) means 'while the good state still lasts'; ないうちに means 'before the state changes' from the negative side.
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.