A green, simple, and cost effective electrochemical method to synthesize pure graphene oxide (GO) and graphene nanosheets (GNs) using pencil in ionic liquid medium is reported. The morphology and microstructure of prepared GNs and GO are examined using scanning electron microscopy (SEM), transmission electron microscopy (TEM), atomic force microscopy (AFM), X‐ray diffraction (XRD), and Raman spectroscopy; the experiments confirm the formation of high quality graphene. The synthesized GO is used for the real‐time and label‐free surface plasmon resonance (SPR) sensing of the biological warfare agent Salmonella typhi.