Question:

Is something a sin if it's illegal?


Answer:

Sin is breaking God's law. "Everyone who practices sin also practices lawlessness; and sin is lawlessness" (I John 3:4). One of God's laws is "Every person is to be in subjection to the governing authorities. For there is no authority except from God, and those which exist are established by God. Therefore whoever resists authority has opposed the ordinance of God; and they who have opposed will receive condemnation upon themselves" (Romans 13:1-2).

There is one corollary to this that isn't immediately obvious. Since a government's authority comes from God, a government violating God's laws is not to be obeyed. God's laws always come first. "But Peter and the apostles answered, "We must obey God rather than men"" (Acts 5:29).