Switch encoding