Formality: “有空” is a neutral term suitable for most situations, from casual chats with friends to informal business settings. In a highly formal context, you might use the more polite
方便 (fāngbiàn), as in “请问您什么时候方便?” (Qǐngwèn nín shénme shíhou fāngbiàn? - Excuse me, when would be convenient for you?), but “有空” remains universally understood and widely accepted.