12 volt input

Yes you can use a relay but it's kind of a large, expensive and power-hungry way to solve a simple problem.

Read up on "voltage dividers".

Also read up on the protection diodes that exist on every single Arduino input pin.

Now design your divider and consider what might happen if it's hooked up wrong - what if it's connected to 24V or hooked up backwards. How much current flows through that protection diode? While the specs on the diodes are impossible to pin down, the accepted advice seems to be to keep the current in the diode under 2mA. Choose divider resistors that will keep this current low under most reasonable fault conditions.