How to amplify 3.3 volts PWM to 5 volts PWM
You should specifiy your maximum PWM frequency.
The switching speed of the circuit below is likely to be fast enough for most Arduino or Pi PWM applications. 

Here is a simple and slightly unusual circuit that will do what you want in most cases.
The transistor base is connected to the low voltage supply (here 3V3) by a resistor, and the emitter is driven directly by the low voltage (here 3V3) PWM.  

Almost any small signal NPN "jellybean" transistor can be used.
A small capacitor across R1 (maybe 1 nF - experiment) will somewhat improve frequency response - but is unlikely to be needed.

This arrangement means that when the PWM input is low the transistor is on, it's collector is low and so the output PWM is low - so their is no "phase inversion".    







simulate this circuit &ndash; Schematic created using CircuitLab