The two-gene expression ratio HOXB13:IL17BR has been proposed to predict the outcome of tamoxifen-treated breast cancer patients. We intended to examine whether this ratio can predict the benefit of 5 years vs. 2 years of tamoxifen treatment of postmenopausal patients. A further objective was to investigate any prognostic effects of the ratio in systematically untreated premenopausal patients. Based on the current knowledge of HOXB13 and IL17BR, we hypothesized that these genes may have individual prognostic or predictive power. Expression of HOXB13 and IL17BR were quantified by real-time PCR in tumors from 264 randomized postmenopausal patients and 93 systemically untreated premenopausal patients. A high HOXB13:IL17BR ratio was associated with aggressive tumor characteristics, as were low levels of IL17BR alone. The ratio and HOXB13 alone predicted recurrence-free survival after endocrine treatment, with a benefit of prolonged treatment in estrogen receptor-positive patients correlated to a low ratio (recurrence rate ratio: RR = 0.39; P = 0.030), or low expression of HOXB13 (RR = 0.37; P = 0.015). No difference in recurrence-free survival was seen for the high ratio or high HOXB13 subgroups. The predictive value of HOXB13 and HOXB13:IL17BR was significant in multivariate analysis. In the systemically untreated cohort, only IL17BR showed independent prognostic significance. We conclude that the ratio or HOXB13 alone can predict the benefit of endocrine therapy, with a high ratio or a high expression rendering patients less likely to respond. We have also shown that IL17BR might be an independent prognostic factor in breast cancer.