An isolated, synthetic or recombinant nucleic acid comprising (a) a nucleic acid sequence encoding a polypeptide having a phytase activity and having at least 95%, 96%, 97%, 98% or 99% or more sequence identity to SEQ ID NO:1, and having a nucleotide modification, wherein the nucleotides at positions 406 to 408 of SEQ ID NO: 1 are changed to CAT or CAC, wherein the polypeptide has improved thermostability over the phytase of SEQ ID NO:2; (b) a nucleic acid encoding a polypeptide having a phytase activity and having at least 95%, 96%, 97%, 98% or 99% or more sequence identity to SEQ ID NO:2, and having an amino acid modification wherein the amino acid threonine at amino acid position 136 if SEQ ID NO: 2 is changed to a histidine, wherein the polypeptide has improved thermostability over the phytase of SEQ ID NO:2; (c) the nucleic acid sequence of (a) or (b) encoding a polypeptide having a phytase activity but lacking: a signal sequence or proprotein sequence, or a homologous promoter sequence; (d) the nucleic acid of any of (a) to (c) encoding a polypeptide having a phytase activity and further comprising a heterologous amino acid sequence, or the nucleic acid of any of (a) to (c) further comprising a heterologous nucleotide sequence; (e) the nucleic acid of (d), wherein the heterologous amino acid sequence comprises, or consists of a sequence encoding a heterologous (leader) signal sequence, or a tag or an epitope, or the heterologous nucleotide sequence comprises a heterologous promoter or encodes a targeting sequence; or (f) a nucleic acid sequence completely complementary to the nucleic acid sequence of any of (a) to (e). (a) a nucleic acid sequence encoding a polypeptide having a phytase activity and having at least 95%, 96%, 97%, 98% or 99% or more sequence identity to SEQ ID NO:1, and having a nucleotide modification, wherein the nucleotides at positions 406 to 408 of SEQ ID NO: 1 are changed to CAT or CAC, wherein the polypeptide has improved thermostability over the phytase of SEQ ID NO:2; (b) a nucleic acid encoding a polypeptide having a phytase activity and having at least 95%, 96%, 97%, 98% or 99% or more sequence identity to SEQ ID NO:2, and having an amino acid modification wherein the amino acid threonine at amino acid position 136 if SEQ ID NO: 2 is changed to a histidine, wherein the polypeptide has improved thermostability over the phytase of SEQ ID NO:2; (c) the nucleic acid sequence of (a) or (b) encoding a polypeptide having a phytase activity but lacking: a signal sequence or proprotein sequence, or a homologous promoter sequence; (d) the nucleic acid of any of (a) to (c) encoding a polypeptide having a phytase activity and further comprising a heterologous amino acid sequence, or the nucleic acid of any of (a) to (c) further comprising a heterologous nucleotide sequence; (e) the nucleic acid of (d), wherein the heterologous amino acid sequence comprises, or consists of a sequence encoding a heterologous (leader) signal sequence, or a tag or an epitope, or the heterologous nucleotide sequence comprises a heterologous promoter or encodes a targeting sequence; or (f) a nucleic acid sequence completely complementary to the nucleic acid sequence of any of (a) to (e).