In this paper, we propose a novel differential encoder for QAM (quadrature-amplitude modulation), by a look-up table instead of a rule. Using a table for differential encoding has the advantages of both low complexity and good error performance. We propose algorithms to construct the table for maximizing the minimum noncoherent distance and minimizing the number of different data bits between two codewords with small noncoherent distance. For 16QAM and 32QAM, we show that the differential encoders obtained by the proposed algorithms are optimal in terms of minimum noncoherent distance. Differential detectors for QAM, including a reduced-complexity two-symbol detector and multiple-symbol detectors, are proposed as well. Simulation results of 16QAM show that the proposed differential encoder provides significant gain over existent differential encoders as expected by distance analysis, and the proposed low-complexity multiple-symbol differential detector can further improve the error performance.