The Portal Gun is an endgame utility item that can be found when the Moon Lord is defeated. When used from the hotbar, left-clicking will place an orange portal on any surface that is at least 3 blocks across horizontally, vertically and even diagonally. Right-clicking will place a blue portal with the same constraints. Jumping into (or even making contact with) either portal will first teleport the player to the location of the other portal, then will fling them as if they'd jumped from it.
While falling, firing the portal gun will make you speed up dramatically.
While the portal gun is held, a player's maximum falling velocity is increased from 51mph to 179mph (Tested with stopwatch).
After a certain distance, the portals will despawn.
It works in a similar fashion to the gun in Valve's famous Portal franchise, as Redigit was required to obtain permission from Valve before making the gun.
In multiplayer, the colours change to Atlas and P-Body's (the robots in co-op mode in Portal 2) portal colours to avoid confusion between players.
In Portal and Portal 2, left-clicking shoots a blue portal and right-clicking places an orange portal. In Terraria, the controls are reversed, and in order to shoot an orange portal you must left-click, and in order to shoot the blue portal you must right-click.