Cationic agents, such as ionic liquids (ILs)-based species, have broad-spectrum antibacterial activities. However, the antibacterial mechanisms lack systematic and molecular-level research, especially for Gram-negative bacteria, which have highly organized membrane structures. Here, we designed a series of flexible fluorescent diketopyrrolopyrrole-based ionic liquid derivatives (ILDs) with various molecular sizes (1.95−4.2 nm). The structure−antibacterial activity relationships of the ILDs against Escherichia coli (E. coli) were systematically studied thorough antibacterial tests, fluorescent tracing, morphology analysis, molecular biology, and molecular dynamics (MD) simulations. ILD-6, with a relatively small molecular size, could penetrate through the bacterial membrane, leading to membrane thinning and intracellular activities. ILD-6 showed fast and efficient antimicrobial activity. With the increase of molecular sizes, the corresponding ILDs were proven to intercalate into the bacterial membrane, leading to the destabilization of the lipid bilayer and further contributing to the antimicrobial activities. Moreover, the antibacterial activity of ILD-8 was limited, where the size was not large enough to introduce significant membrane disorder. Relative antibacterial experiments using another common Gram-negative bacteria, Pseudomonas aeruginosa (PAO1), further confirmed the proposed structure-antibacterial activity relationships of ILDs. More impressively, both ILD-6 and ILD-12 displayed significant in vivo therapeutic effects on the PAO1-infected rat model, while ILD-8 performed poorly, which confirmed the antibacterial mechanism of ILDs and proved their potentials for future application. This work clarifies the interactions between molecular sizes of ionic liquid-based species and Gram-negative bacteria and will provide useful guidance for the rational design of high-performance antibacterial agents.