Objective To explore the potential bidirectional causality between atrial fibrillation(AF)/atrial flutter(AFL)and insomnia by two sample Mendelian randomization(MR).Methods The summary data for AF/AFL and insomnia were obtained from the genome-wide association study(GWAS)in IEU OpenGWAS project databases respectively.Significant and independent single nucleotide polymorphisms(SNPs)were extracted for MR analysis.Inverse-variance weighted(IVW),weighted median(WM),MR-Egger,simple mode and weighted mode were used to assess causality.In addition,the heterogeneity of IVW was examined by Cochran's Q test,MR-Egger test was used to detect horizontal pleiotropy,the outliers were detected by MR-PRESSO method to test gene pleiotropy and the leave-one-out sensitivity analysis was conducted to ensure result robustness.Results With AF/AFL as exposure and insomnia as outcome,a total of 47 SNPs were screened as instrumental variables,and IVW showed a positive causal relationship between AF/AFL and insomnia[OR=1.103,95%CI(1.008,1.208),P<0.05].The βvalues were in the same direction of WM,MR-Egger,simple mode and weighted mode with that of IVW.Sensitivity analysis shows that there was no heterogeneity in the results of Cochran's Q test(P>0.05),and MR-Egger test(P>0.05)indicated that there was no horizontal pleiotropy.At the same time,no outlier value was detected by MR-PRESSO method,and there was no gene pleiotropy.No SNP was tested with leave-one-out method,indicating that the results were robust and unbiased.When insomnia as exposure and AF/AFL as outcome,a total of 12 SNPs were screened as instrumental variables,and IVW showed there was no causal relationship between insomnia and AF/AFL[OR=0.989,95%CI(0.951,1.029),P>0.05].Conclusion AF/AFL will increase the risk of insomnia.In the management of insomnia patients,common arrhythmia diseases such as AF and AFL should be actively prevented and treated.