PURPOSE: Previously, we developed an automatic three-dimensional gray-value registration (GR) method for fast prostate localization that could be used during online or offline image-guided radiotherapy. The method was tested on conventional computed tomography (CT) scans. In this study, the performance of the algorithm to localize the prostate on cone-beam CT (CBCT) scans acquired on the treatment machine was evaluated. METHODS AND MATERIALS: Five to 17 CBCT scans of 32 prostate cancer patients (332 scans in total) were used. For 18 patients (190 CBCT scans), the CBCT scans were acquired with a collimated field of view (FOV) (craniocaudal). This procedure improved the image quality considerably. The prostate (i.e., prostate plus seminal vesicles) in each CBCT scan was registered to the prostate in the planning CT scan by automatic 3D gray-value registration (normal GR) starting from a registration on the bony anatomy. When these failed, registrations were repeated with a fixed rotation point locked at the prostate apex (fixed apex GR). Registrations were visually assessed in 3D by one observer with the help of an expansion (by 3.6 mm) of the delineated prostate contours of the planning CT scan. The percentage of successfully registered cases was determined from the combined normal and fixed apex GR assessment results. The error in gray-value registration for both registration methods was determined from the position of one clearly defined calcification in the prostate gland (9 patients, 71 successful registrations). RESULTS: The percentage of successfully registered CBCT scans that were acquired with a collimated FOV was about 10% higher than for CBCT scans that were acquired with an uncollimated FOV. For CBCT scans that were acquired with a collimated FOV, the percentage of successfully registered cases improved from 65%, when only normal GR was applied, to 83% when the results of normal and fixed apex GR were combined. Gray-value registration mainly failed (or registrations were difficult to assess) because of streaks in the CBCT scans caused by moving gas pockets in the rectum during CBCT image acquisition (i.e., intrafraction motion). The error in gray-value registration along the left-right, craniocaudal, and anteroposterior axes was 1.0, 2.4, and 2.3 mm (1 SD) for normal GR, and 1.0, 2.0, and 1.7 mm (1 SD) for fixed apex GR. The systematic and random components of these SDs contributed approximately equally to these SDs, for both registration methods. CONCLUSIONS: The feasibility of automatic prostate localization on CBCT scans acquired on the treatment machine using an adaptation of the previously developed three-dimensional gray-value registration algorithm, has been validated in this study. Collimating the FOV during CBCT image acquisition improved the CBCT image quality considerably. Artifacts in the CBCT images caused by large moving gas pockets during CBCT image acquisition were the main cause for unsuccessful registration. From this study, we can conclude that CBCT scans are suitable for online and offline position verification of the prostate, as long as the amount of nonstationary gas is limited.