Beam hardening in x-ray computed tomography (CT) is inevitable because of the polychromatic x-ray spectrum and energy-dependent attenuation coefficients of materials, leading to the underestimation of artifacts arising from projection data, especially on metal regions. State-of-the-art research on beam-hardening artifacts is based on a numerical method that recursively performs CT reconstruction, which leads to a heavy computational burden. To address this computational issue, we propose a constrained beam-hardening estimator that provides an efficient numerical solution via a linear combination of two images reconstructed only once during the entire process. The proposed estimator reflects the geometry of metal objects and physical characteristics of beam hardening during the transmission of polychromatic x-rays through a material. Most of the associated parameters are numerically obtained from an initial uncorrected CT image and forward projection transformation without additional optimization procedures. Only the unknown parameter related to beam-hardening artifacts is fine-tuned by linear optimization, which is performed only in the reconstruction image domain. The proposed approach was systematically assessed using numerical simulations and phantom data for qualitative and quantitative comparisons. Compared with existing sinogram inpainting-based and model-based approaches, the proposed scheme in conjunction with the constrained beam-hardening estimator not only provided improved image quality in areas surrounding the metal but also achieved fast beam-hardening correction owing to the analytical reconstruction structure. This work may have significant implications in improving dose calculation accuracy or target volume delineation for treatment planning in radiotherapy.