There are a number of tubes that are pinout compatible with the 12ax7. However, many of these have radically different electrical characteristics, and are not a good idea to try.
However, the following are all 100% compatible, and are considered to be essentially the same tube: 12ax7, 12ax7a, 12ax7wa, ecc83, e83cc, 7025. Another that is about 70% compatible, but that has significantly lower gain is the 5751.
The 12AU7, 12AT7, 12AY7, 12AZ7 are all pinout compatible, but should NOT be used in a 12AX7 circuit. Doing so could potentially damage either the tubes, or the circuits, and may or may not produce sound, depending upon exactly how the circuit it biased.
"Tube rolling" is the long practiced art of swaping different makes of tubes, but usually for the same basic type of tubes. The differences in sound between two tubes with the exact same designation, but made by different manufacturers can be shocking in my experience.
So stick with the above list, and try tube from different manufactures. My personal favorites of the new stock 12ax7s are the EI 12AX7s, but tastes vary, so you may or may not like these at all.
Good luck!