A new water-soluble poly(propylene imine) dendrimer (PPI) modified with 4-sulfo-1,8-naphthalimid units (SNID) and its related structure monomer analog (SNIM) has been prepared by a simple synthesis. The aqueous solution of the monomer exhibited aggregation-induced emission (AIE) at 395 nm, while the dendrimer emitted at 470 nm due to an excimer formation beside the AIE at 395 nm. Fluorescence emission of the aqueous solution of eitherSNIMorSNIDwas significantly affected by traces of different miscible organic solvents, and the limits of detection were found to be less than 0.05% (v/v). Moreover,SNIDexhibited the function to execute molecular size-based logic gates where it mimics XNOR and INHIBIT logic gates using water and ethanol as inputs and the AIE/excimer emissions as outputs. Hence, the concomitant execution of both XNOR and INHIBIT enablesSNIDto mimic digital comparators.