This article introduces Wilson operators and 't Hooft operators in compact quantum electrodynamics without matter using the canonical formulation (operators on a Hilbert space) in D-dimensional space at a single time. Compact means that gauged group is the compact group U(1). This article relates those operators to the operators representing magnetic and electric flux, which are localized on submanifolds with 2 and (D-1) dimensions, respectively. The flux operators and their equal-time commutation relation are previewed in smooth space first and then treated more carefully using a lattice model. In the lattice model, the basic gauge invariant operators are Wilson operators and 't Hooft operators localized on submanifolds with 1 and (D-1) dimensions, respectively. These are used to define the flux operators, and then smeared versions of the flux operators are used to define other types of Wilson and 't Hooft operators localized on submanifolds with 2 and (D-2) dimensions, respectively.