선형대수학에서 단위 행렬(영어: unit matrix) 또는 항등 행렬(영어: identity matrix)은 주대각선의 원소가 모두 1이며 나머지 원소는 모두 0인 정사각 행렬이다.[1]:100
체
위의
단위 행렬
는 다음과 같이 정의된다.

여기서
는 크로네커 델타이다. 이를 행렬 기호로 쓰면 다음과 같다.

작은 크기의 단위 행렬들은 다음과 같다.



임의의 체
위의
행렬
에 대하여, 다음과 같은 항등식이 성립한다.

특히, 체
위의
단위 행렬은 체
위의
정사각 행렬의 곱셈 모노이드
의 항등원이다.
체
위의
단위 행렬
의 고윳값은 1이며, 그 대수적 중복도와 기하적 중복도는 모두
이다. 즉,
위의
차원 벡터 공간에서 자기 자신으로 가는 선형 변환이
을 행렬로 한다면, 이는 기저와 상관 없이 항등 함수이다.
모든 실수 양의 정부호 이차 형식은 단위 행렬을 행렬로 하는 이차 형식(즉, 제곱 합 이차 형식)과 동치이다.