Clapping on Shabbat

Dear Rabbi Simon,
I have learned that there are restrictions on the use of musical instruments on Shabbat, such as guitar, flute, organ, drum, etc.  Recently, a friend told me that this extends to dancing, clapping one’s hands and even tapping on a table to the beat of a song.  Yet I know I have seen knowledgeable people doing these things.  Can you please clarify this? (It would be music to my ears.)

Dear Michaela,
Thank you for your question.  The Talmud forbids playing musical instruments on Shabbat out of concern that the musician may inadvertently repair or adjust the instrument in a way which involves a melakhah.  Based on this, the Shulkhan ‘Arukh (OH 339:3) also forbids dancing, clapping, and striking the table (for example) to the beat of the music.  However, R Moshe Isserles (Rema, ibid., based on Tosafot) justifies the common practice to do all of these things on Shabbat, since we are generally not expert in repairing musical instruments, and there is no longer any reason to imagine that dancing/clapping, etc. may lead to the inadvertent performance of a melakhah.
The later authorities debate whether Rema actually intends to permit these activities outright, or only to propose a justification/mitigation for those who are lenient.
In practice, while many are stringent, there are those who follow Rema, Arukh ha-Shulhan, and others that all these activities are allowed.  Rav Moshe Feinstein (OH 2:100), for example, justifies dancing in a circle on Shabbat, on the basis that it is not much more than synchronised walking.  Other lenient considerations are for purposes of a mitzvah, tefillah, honour of the Torah, etc.  During bein ha-shemashot (twilight) there are also grounds to be more lenient.  (This may be relevant to Kabbalat Shabbat and Seudah Shelishit.)
Clapping for other reasons (ie, not for music) or knocking on a door (with one’s hands), but not in a rhythmic way, is definitely allowed.
Bottom line: There are certainly grounds on which to be stringent WRT clapping and tapping to music, but those who are lenient, particularly for spiritual/mitzvah purposes, have a halakhic basis upon which to rely.
I hope this is helpful.
Thank you again for prompting me to investigate this topic.
Rabbi Rashi Simon