Is there any way to connect 20-25V 1MHz digital input to arduino?
From the reference to optocouplers, presumably the source signal is not ground-referenced to the Arduino. 

In such case, an optocoupler such as Toshiba 6N137 can be used. This is rated for 10 megabaud, so up to 10 MHz can be coupled using it. This optocoupler is $0.82 at Mouser, but lower cost components can be found, for the much lower frequency 1 MHz signal. 

A typical schematic for this would be thus:





If the incoming signal is referenced to the Arduino's ground, then a simple voltage divider would work for dropping the voltage down to the required 0-5 Volts (or 0-3.3 Volts for some newer Arduino boards). Pick resistors for the divider such that their paralleled impedance is equal to or higher than the output impedance of the signal source.

This then needs to be followed up with a unity gain buffer, even a basic rail-to-rail-output single-supply op-amp as buffer or a BJT voltage follower circuit would serve. 

Alternatively, the voltage-divided input could be used to switch a MOSFET, thus allowing the output to go quite close to each rail. Look for a MOSFET with logic level gate, and low gate capacitance.