I noticed when working on my current project that there’s nice defines for setting and clearing a bit, but none for toggling a bit. I think this #define based on the others would do the job, but I haven’t tested it:

#define bitToggle(value, bit) ((value) ^= (1UL << (bit)))

you should write a test program for it ;) - it looks ok.

if you are interested in bithacks check -

These are my defines:

#define SetB(PORT, BIT)		((PORT) |= 1<< (BIT))
#define ClrB(PORT, BIT)		((PORT) &= 1<< (BIT))
#define TogB(PORT, BIT)		((PORT) ^= 1<< (BIT))
#define TestB(PORT, BIT) 	((PORT) & (1<<BIT))

Not compatible with Arduino Pin numbers.