A thermal displacement compensating device for a machine tool, comprising: temperature sensors arranged at predetermined portions on a structural body of the machine tool; block temperature obtaining means (91; 291) that obtains temperatures of respective blocks based on temperature information detected by the temperature sensors wherein temperatures in each of the respective blocks into which the structural body of the machine tool is divided are defined as a uniform value; finite element method analysis means (92; 192) that performs a structural analysis by a finite element method based on the temperatures of the respective blocks obtained by the block temperature obtaining means (91; 291) and that infers thermal displacement amounts {δ} of the structural body of the machine tool; compensation value calculation means (93; 193) that calculates a compensation value for a command position by an NC program of a movable body of the machine tool based on the thermal displacement amounts {δ} of the structural body of the machine tool inferred by the finite element method analysis means (92; 192); and compensation means that compensates the command position by the compensation value obtained by the compensation value calculation means (93;193) wherein dimensions of the respective blocks are set to be larger than the dimensions of the respective elements in the structural analysis by the finite element method; and each block includes a large number of elements and a larger number of nodes; and the structural analysis is performed on the assumption that temperatures at the plurality of nodes included in the same block (100, 100) are a uniform value. temperature sensors arranged at predetermined portions on a structural body of the machine tool; block temperature obtaining means (91; 291) that obtains temperatures of respective blocks based on temperature information detected by the temperature sensors wherein temperatures in each of the respective blocks into which the structural body of the machine tool is divided are defined as a uniform value; finite element method analysis means (92; 192) that performs a structural analysis by a finite element method based on the temperatures of the respective blocks obtained by the block temperature obtaining means (91; 291) and that infers thermal displacement amounts {δ} of the structural body of the machine tool; compensation value calculation means (93; 193) that calculates a compensation value for a command position by an NC program of a movable body of the machine tool based on the thermal displacement amounts {δ} of the structural body of the machine tool inferred by the finite element method analysis means (92; 192); and compensation means that compensates the command position by the compensation value obtained by the compensation value calculation means (93;193) wherein dimensions of the respective blocks are set to be larger than the dimensions of the respective elements in the structural analysis by the finite element method; and each block includes a large number of elements and a larger number of nodes; and the structural analysis is performed on the assumption that temperatures at the plurality of nodes included in the same block (100, 100) are a uniform value.