For most adults with HIV-1 and hepatitis B virus (HBV) coinfection, initial recommended treatment is a tenofovir-containing antiretroviral regimen, but no randomised studies have compared tenofovir disoproxil fumarate with tenofovir alafenamide. We aimed to investigate whether bictegravir, emtricitabine, and tenofovir alafenamide is non-inferior to dolutegravir, emtricitabine, and tenofovir disoproxil fumarate for viral suppression in individuals with HIV-1 and HBV coinfection at 48 and 96 weeks. We did this randomised, double-blind, active-controlled, phase 3, non-inferiority trial at 46 outpatient centres in China, Dominican Republic, Hong Kong, Japan, Malaysia, South Korea, Spain, Taiwan, Thailand, Turkey, and the USA. Eligible participants were treatment-naive adults (aged ≥18 years) with plasma HIV-1 RNA of at least 500 copies per mL and plasma HBV DNA of at least 2000 IU/mL. Participants were randomly assigned (1:1) to receive daily oral bictegravir 50 mg, emtricitabine 200 mg, and tenofovir alafenamide 25 mg, or dolutegravir 50 mg, emtricitabine 200 mg, and tenofovir disoproxil fumarate 300 mg, each with corresponding matching placebo. Randomisation was stratified by hepatitis B e antigen (HBeAg) status (positive vs negative), HBV DNA (<8 vs ≥8 log10 IU/mL), and CD4 count (<50 vs ≥50 cells per μL) at screening. All investigators, participants, and staff providing treatment, assessing outcomes, and collecting data were masked to study treatment for 96 weeks. Coprimary endpoints were the proportion of participants with plasma HIV-1 RNA less than 50 copies per mL (defined by the US Food and Drug Administration snapshot algorithm) and plasma HBV DNA less than 29 IU/mL (using the missing-equals-failure approach) at week 48, with a prespecified non-inferiority margin of -12%. Coprimary endpoints were assessed in the full analysis set, which included all randomly assigned participants who received at least one dose of study drug and had at least one post-baseline HIV-1 RNA or HBV DNA result while on study drug. Safety endpoints were assessed in all randomly assigned participants who received at least one dose of study drug. This trial is registered with ClinicalTrials.gov, NCT03547908. Between May 30, 2018 and March 16, 2021, 381 participants were screened, of whom 243 initiated treatment (121 in the receive bictegravir, emtricitabine, and tenofovir alafenamide group; 122 in the dolutegravir, emtricitabine, and tenofovir disoproxil fumarate group). At week 48, both endpoints met the criteria for non-inferiority: 113 (95%) of 119 participants in the bictegravir, emtricitabine, and tenofovir alafenamide group and 111 (91%) of 122 participants in the dolutegravir, emtricitabine, and tenofovir disoproxil fumarate group had HIV-1 RNA less than 50 copies per mL (difference 4·1, 95% CI -2·5 to 10·8; p=0·21), and 75 (63%) of 119 participants in the bictegravir, emtricitabine, and tenofovir alafenamide group versus 53 (43%) of 122 participants in the dolutegravir, emtricitabine, and tenofovir disoproxil fumarate group had HBV DNA suppression (difference 16·6, 5·9 to 27·3; nominal p=0·0023). Drug-related adverse events up to week 96 occurred in 35 (29%) of 121 participants in the bictegravir, emtricitabine, and tenofovir alafenamide group and 34 (28%) of 122 participants in the dolutegravir, emtricitabine, and tenofovir disoproxil fumarate group. One (1%) of 121 participants in the bictegravir, emtricitabine, and tenofovir alafenamide group reported a serious adverse event (cryptococcal meningitis attributed to immune reconstitution inflammatory syndrome) that was deemed to be treatment-related. Coformulated bictegravir, emtricitabine, and tenofovir alafenamide is an effective therapy for adults with HIV-1 and HBV coinfection starting antiviral therapy. Gilead Sciences.