You can use Form 3903 to deduct your moving expenses.
Your move must occur within 1 year of the start of work at the new location. Note, you do not necessarily have to arrange for work at a new location before you move, so long as you begin work within one year of the move.
Furthermore, your new home must not be farther from your new work location than your old home. Exceptions to this rule are allowed if you must live at your new home as a condition of employment or you will spend less time or money commuting from your new location.
Your move must also pass what’s called the “distance test”: your new job location must be at least 50 miles farther from your old house than your old job location was.
Furthermore you must pass the “time test”: you must work full time for at least 39 weeks of the first 12 months after your move.
Keep in mind that different rules may apply to certain retirees, survivors, and members of the Armed Forces.