BGP speakers that support 4-byte ASNs advertise this via BGP capability negotiation and there is backward compatibility. When a “new” router talks to an “old” router (one that only supports 2-byte AS numbers), it can use a reserved AS number (23456) called AS_TRANS instead of its 4-byte AS number.

The value of AS_TRANS is statically set to 23456 by the IANA.