An optofluidic 1x4 switch is designed, fabricated, and tested. The switch is based on a blazed diffraction grating imprinted onto silicone elastomer at the bottom of a microfluidic channel that is filled with liquids with different refractive indices. When the condition of a diffraction maximum is met, the laser beam incident on the grating is deflected by an angle proportional to the refractive index mismatch between the elastomer and the liquid in the channel. The switch was tested using four different aqueous salt solutions generating 0(th) to 3(rd) orders of diffraction. The insertion loss was <2.5dB, the extinction ratio was >9.8dB, and the response time was 55 ms. The same basic design can be used to build optofluidic switches with more than 4 outputs.