Which card do you have?
While each card can be used between different train lines and payment systems (for example, Suica can be used where it says Pasmo), you can only get your money refunded from the office for that particular card. It also means that if you purchase a card in Tokyo but depart Japan from Osaka you won’t be able to get a refund because the operators are different.
Suica: JR East offices (Tokyo area)
Icoca: JR West offices (Osaka / Kyoto area)
Pasmo: Offices for Tokyo Metro and most private lines (Tokyu, Toei, Keisei, Keikyu) in the Tokyo area
Go to the office
For JR offices it’s much more clear where to go as they are prominent in most major stations, such as where you can redeem a Japan Rail Pass. Otherwise, there are also small JR offices at any station with the JR line. However, if you purchase a Suica card on a non-JR line (such as Tokyo Monorail when coming from Haneda) you’ll need to go to that specific line to get your refund. It’s more confusing than it needs to be at this point in time, so just be aware.
If you’re using Pasmo or another card, you need to go to one of their offices. These can be harder to find, and the English level of the staff is hit or miss. Best would be to show them this phrase:
「交通ICカード（PasmoやSuica等）を払い戻ししたいです」(I would like to refund my e-money card please)
If they cannot do it at that office, you’ll surely be directed to a place where you can, but your best bet in any case is to get a refund at the exact same place you originally purchased the card.
If you don’t have time to get a refund
Since you can only load each card with up to 10,000 yen each time, most people won’t have large balances left over at the end of their trip. Still, since you want to use the rest of the money on your card you have a lot of options to spend it.
Nearly any convenience store in Japan accepts the cards for payment, so load up on interesting food and snacks for your trip, or to bring home for friends! You’ll also be able to use the cards in certain shops in the airport, so that could be the best option for you to unload that balance and return home with some interesting things.
Of course, another great option is to just hold on to the card for your next trip to Japan!
When you purchased your card you paid a 500 yen deposit which was included in the total price. So if you plan to get a refund you will receive your deposit plus any remaining balance, but also have to pay a small refund charge of 220 yen. This will be deducted from your final refund, unless your final balance is less than 220 yen…. in which case you will pay the final balance as your refund! Why? Don’t ask questions.