If a person who is overstaying in Japan would like to clear that status, he/she has to go to local immigration bureau for special permission to stay in Japan. It is much likely to obtain special permission to go immigration than to apply for it after detention in immigration bureau.
Technically speaking, application for special permission is not proper application, but rather only a convenient way to name it. Within the procedures for deportation, you may be granted a visa to reside in Japan if the Minister of Justice determines that there are circumstances in which you should be specially allowed to stay in Japan.
Depending on the status of the person, visa will be either spouse or child of a Japanese national spouse or child of a permanent resident or long-term resident.
How to apply
The applicant will go to their local immigration bureau, not branch, to apply and explain the purpose of desire to stay in Japan. At the bureau, it is recommended that you prepare all necessary documents to submit at the time you apply so that the procedures after go more smoothly.
The criteria of special permission is not publicly disclosed.
The probability of permission depends on international situation as well as personal circumstances of the applicant.
Generally, it is said that the probability of acceptance of each visa category is as follows, starting from the highest: 1. Spouse or child of Japanese national, 2. Spouse of special permanent resident, 3. Spouse of permanent resident.
Even though the spouse is Japanese, cases where it was exposed before marriage that the marriage was only for the purpose of gaining the marriage status are taken seriously and treated strictly.
On the other hand, cases where this was exposed during unexpected difficulties, which happen during the marriage process after having lived together or been in a relationship together, are generally more likely to be approved than last-minute marriages.