\(K3\) surfaces are complex surfaces whose canonical bundles are trivial. We can regard \(K3\) surfaces as 2-dimensional analogy of elliptic curves. There exist good modular functions coming from the moduli of \(K3\) surfaces. Such modular functions are extensions of classical elliptic modular functions. In this talk, first, we recall basic properties of the moduli of \(K3\) surfaces. Next, we will see some examples of \(K3\) modular functions given by several researchers. At the last, the speaker will present a result of the Hilbert modular functions for the minimal discriminant via \(K3\) surfaces. This result has applications in number theory. Namely, the period mappings of \(K3\) surfaces allow us to obtain new explicit models of Shimura curves and a simple construction of class fields over quartic \(CM\)-fields.