Upvote:4
Per TIMATIC, the database used by airlines:
TWOV (Transit Without Visa): Passengers transiting through Tokyo (HND) or Osaka (KIX) with a confirmed onward ticket for a flight to a third country within 72 hours. They must stay in the international transit area of the airport and have documents required for the next destination.
and
Holders of onward tickets transiting to a third country can obtain a Shore Pass on arrival for a max. stay of 72 hours only if there are no connecting flights on the same calendar day
As such, you don't need a visa, even if leaving the airport. If you want to leave the airport present your passport and connecting boarding pass at border control, and ask for a Shore pass.