This paper is concerned with state estimation for systems governed by partial differential equations. Kalman filters are optimal state estimators in that they minimize the estimation error variance for given measurements. The focus of this paper is the achievement of additional minimization of the error variance by also optimizing over the sensor design. The optimal sensor design problem is thus incorporated into the estimation problem. Not only the sensor location but also other factors such as sensor shape and the effect of the sensors on system dynamics are included in the optimization criteria. The problem is first stated formally, and then it is shown to be well-posed and to possess an optimal solution. Applications to a one-dimensional diffusion equation and also to a two-dimensional wave equation are given. A computational framework for calculation of optimal shape is described.