An exercise that I was taught, have seen many times, and also have used with others.
It can be done anywhere.
Instead of tapping my fingers, I do this exercise.
Place your hand on the table (or whatever surface) as though you were resting your fingers on the keys.
"Play" the sequence 1-3-5-2-4, repeating it over and over. Things to work on are your rhythm, make sure that each "note" you play is even.
(For instance, 1-3--2 are more dominant fingers, but make sure ---2-4 are doing their share of the work!)
Work on being able to keep that up for several minutes, keeping the 1-3-5-2-4 progression intact.
I find myself lapsing into 1-3-5-43-5-1 or something equally funky if I'm not careful.
The temptation here is to do this with your dominant hand, but make sure you also do it with the other hand.
The tempo will be much (much, much, much...for me) slower, so spend more timing working with that hand.
This should also be done with both hands, keeping each note in sync.
For me, it usually ends in disaster.
(:
music.stackexchange.com/users/3/Rebecca Chernoff
I used to do all kinds of things, including most of the things everyone here has mentioned.
However, I found that I got the most benefit from doing these things: Do nothing.
Rest.
Don't do anything strenuous with your arms, wrists, and fingers.
If you spend your time effectively at the piano, that's all the physical workout you need.
Most of piano playing is mental, not physical.
These are very fine muscles that you're trying to develop and calibrate, and you would be surprised how much rest (physical and mental) you need away from the keyboard.
Rest all five fingers on a surface, in playing position, and then lift up and down the fourth finger in a very relaxed and isolated way.
The goal is to increase the height of the lift as much as possible, while keeping the other fingers so relaxed that they don't move.
As #2, rest all five fingers on a flat surface, let the weight of the arm be anchored at the fingertips, and then shift that weight from finger to finger, all without lifting the fingers from the surface.
Great exercise to remind yourself how relaxed your arm should be, and how much weight should be felt at the fingertips.
Similarly, do pull ups with your finger, while completely relaxing everything else.
Seated at a table, hook your finger on the table's edge, relax the arm completely, then firm up the hook little by little, and pull up the weight of your arm.
If done right, your neighbor should be able to push your elbow, and your arm should just dangle back and forth on its own.
This is much harder than you think, but helps to reinforce #2 and #3.
Notice that all of the above has to do with relaxing.
Although this may not be the answer you were expecting, consider whether the end result you're looking for (finger strength and dexterity) isn't best achieved by eliminating the natural tension in your playing.
This is the case for even the most advanced players, and you'd be amazed at how much progress can be made with so little work.
So many people, even professionals, forget that there are two parts to practicing – the actual physical and mental practice at the keyboard, and the time away to rest and mentally process what you've done at the keyboard.
One doesn't work without the other.
music.stackexchange.com/users/28858/Max Finis
Book+video: Seymore Fink ,
Mastering Piano Technique ( search )
It has good full arm exercises, to practise both with and away from the piano.
The idea is to work out the muscles involved in playing piano - from shoulder to finger tips, and groove the patterns involved in playing, like the circular motion while playing an arpeggio.
music.stackexchange.com/users/114/ananth.p
I have used the various table-exercises mentioned above.
I suggest getting the Hanon The Virtuoso Pianist in Exercises and the Schmitt book on exercises.
These will give you plenty of patterns to choose from as well as some good stuff do while at the piano.
Now keep in mind that it is more fatiguing to play on a hard surface such as a table, and with fatigue you can get muscle stiffness.
Having said this, you'll find that if you do the above exercises carefully and with relaxed arms and hands while at the piano, for maybe 20 minutes per day, there's no need to do table playing unless you're going to be away from the piano for quite some length of time.
Keep in mind
what you are really strengthening are the tendons as there are no "muscles" in the fingers.
All the work is really done in your forearms and biceps and the tendons are pulled over your elbows by your finger movements.
music.stackexchange.com/users/13751/Retired_Admin
There are many exercises you can do when not actually playing the piano.
one of my favorites is tapping my fingers on a desk in different rhythms.
Personally I like playing with both hands doing the same thing, but that is just personal preference.
I like with the right hand 1-3-5-4-3-4-3-2 on the right hand, which is 5-3-1-2-3-2-3-4 on the left hand.
music.stackexchange.com/users/28907/kaylee wete
Any organised program of mental practice can be very beneficial.
See Malva S Freymuth's Mental Practice and Imagery for Musicians.
See Greg Irvin's "Finger Fitness" on "youtube".
music.stackexchange.com/users/33261/Mark W
my contribution to this effect is to continually pratice your 12345123 for the right and the left 54321321
music.stackexchange.com/users/40864/Decent
Are there any finger exercises I can perform even when I am not near a piano to improve my dexterity and strength of my fingers?
Finger Exercises for Piano when not playing
music.stackexchange.com
<piano><exercises>
music.stackexchange.com/questions/130
music.stackexchange.com/users/128/iddober
Rest all five fingers on a surface, in playing position, and then lift up and down the fourth finger in a very relaxed and isolated way. Alternatively, seated at a table, hook your finger on the table's edge, relax the arm completely, then firm up the hook little by little, and pull up the weight of your arm. Another trick is tapping fingers on the desk in different rhythms. Finally, rest all five fingers on a flat surface, let the weight of the arm be anchored at the fingertips, and then shift that weight from finger to finger, all without lifting the fingers from the surface. Here are some finger excercises for when you are not playing the piano. Taping rhythms onto a desk with your fingers. Using resistance against the edge of a table with your little fingers. Weight shifts between fingers and isolating finger movements 
Finger exercises taping rhythms on a desk Fingers exercises using resistance against the edge of a table, weight shifts between fingers and moving the fourth finger up and down in isolation from the other fingers.  