바이트 순서(byte order)는 여러 바이트로 이루어진 값을 메모리에 둘 때 바이트를 주소 순서로 늘어놓는 순서다. 가장 낮은 주소에 최상위 바이트를 두는 방식을 빅 엔디언(big-endian), 최하위 바이트를 두는 방식을 리틀 엔디언(little-endian)이라 한다.[1][2] 엔디언(endianness)이라고도 한다.[3][4] 예를 들어 uint32_t 값 0x01020304는 빅 엔디언에서 01 02 03 04, 리틀 엔디언에서 04 03 02 01 네 바이트로 표현된다.[1]

바이트 순서는 서로 다른 처리 장치 사이의 통신에서 중요하다.[2][5]

네트워크 바이트 순서

IP 명세인 RFC 791은 헤더와 데이터의 옥텟을 번호 순서대로 보내고, 여러 옥텟으로 된 수는 최상위 옥텟을 먼저 보내도록 정한다.[6] glibc 매뉴얼은 네트워크로 보내는 데이터에 쓰는 표준 바이트 순서를 네트워크 바이트 순서라 부른다.[5] POSIX.1-2024는 네트워크 바이트 순서를 빅 엔디언으로 둔다.[1]

이 표준은 호스트 바이트 순서와 네트워크 바이트 순서 사이에서 값을 변환하는 함수 htonl, htons, ntohl, ntohs를 둔다. htonl과 ntohl은 32비트 값을, htons와 ntohs는 16비트 값을 다룬다.[7]

IEN 137에 따르면 비트 순서와 바이트 순서는 같을 수도 있고 다를 수도 있다. 이 글에서 Danny Cohen은 1980년, 워드의 어느 쪽 끝부터 보낼지로 나뉜 두 진영을 걸리버 여행기의 달걀 논쟁에 빗대어 Little-Endians와 Big-Endians라 불렀다.[8]

IEEE 802.3-2022는 이더넷 MAC(Medium Access Control) 프레임의 옥텟을 FCS(Frame Check Sequence)만 빼고 모두 최하위 비트부터 보내도록 정한다. FCS에 담는 32비트 CRC는 최고차 항의 계수부터 보낸다.[9]

프로세서

Intel 64와 IA-32(Intel Architecture, 32-bit) 프로세서는 리틀 엔디언이며, 워드의 바이트에 최하위 바이트부터 번호를 매긴다.[10]

Arm A-profile 아키텍처의 AArch64는 명시적 데이터 접근의 엔디언을 시스템 레지스터 필드 SCTLR_ELx.EE와 SCTLR_EL1.E0E로 정한다. 구현은 예외 수준마다 빅 엔디언과 리틀 엔디언을 섞어 쓰게 하거나 한쪽만 지원할 수 있다. A64 명령어는 늘 리틀 엔디언이다.[4]

차량 통신

SOME/IP 명세는 헤더 필드를 모두 네트워크 바이트 순서로 인코딩하도록 정한다. 페이로드 파라미터의 바이트 순서는 설정 파라미터 BYTE_ORDER가 정하며, 값은 mostSignificantByteFirst, mostSignificantByteLast, opaque이고 기본값은 mostSignificantByteFirst(빅 엔디언)다. 길이 필드, TLV(Tag-Length-Value) 태그, 유니언의 타입 필드 같은 일부 페이로드 필드는 BYTE_ORDER와 상관없이 네트워크 바이트 순서다.[11]

AUTOSAR COM은 시그널마다 네트워크 표현의 엔디언을 설정 파라미터 ComSignalEndianness로 정하며, 값으로 BIG_ENDIAN, LITTLE_ENDIAN, OPAQUE를 둔다.[12] AUTOSAR R25-11 System Template은 빅 엔디언을 Motorola 형식, 리틀 엔디언을 Intel 형식이라고도 부른다.[2]

[1]
“be16toh, be32toh, be64toh, htobe16, htobe32, htobe64, htole16, htole32, htole64, le16toh, le32toh, le64toh — convert values between host and specified byte order (The Open Group Base Specifications Issue 8, IEEE Std 1003.1-2024),” 2024. Accessed: Sep. 28, 2026. [Online]. Available: https://pubs.opengroup.org/onlinepubs/9799919799/functions/be16toh.html
[2]
“System Template (AUTOSAR CP R25-11),” AUTOSAR, 2025. Accessed: Sep. 28, 2026. [Online]. Available: https://www.autosar.org/fileadmin/standards/R25-11/CP/AUTOSAR_CP_TPS_SystemTemplate.pdf
[3]
“<endian.h> — system endianness (The Open Group Base Specifications Issue 8, IEEE Std 1003.1-2024),” 2024. Accessed: Sep. 28, 2026. [Online]. Available: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/endian.h.html
[4]
“Arm Architecture Reference Manual for A-profile architecture (ARM DDI 0487 M.c),” Arm Limited, 2026. Accessed: Sep. 28, 2026. [Online]. Available: https://documentation-service.arm.com/static/6a43ea3a072af726f8ef38c0
[5]
“The GNU C Library Reference Manual: Byte Order Conversion (glibc 2.44),” Free Software Foundation, 2026. Accessed: Sep. 28, 2026. [Online]. Available: https://sourceware.org/glibc/manual/latest/html_node/Byte-Order.html
[6]
IETF, “RFC 791 Internet Protocol.” 1981. Accessed: Sep. 26, 2026. [Online]. Available: https://www.rfc-editor.org/rfc/rfc791
[7]
“htonl, htons, ntohl, ntohs — convert values between host and network byte order (The Open Group Base Specifications Issue 8, IEEE Std 1003.1-2024),” 2024. Accessed: Sep. 28, 2026. [Online]. Available: https://pubs.opengroup.org/onlinepubs/9799919799/functions/htonl.html
[8]
D. Cohen, “IEN 137 On Holy Wars and a Plea for Peace.” 1980. Accessed: Sep. 28, 2026. [Online]. Available: https://www.rfc-editor.org/ien/ien137.txt
[9]
IEEE, “IEEE 802.3-2022 IEEE Standard for Ethernet.” 2022. Accessed: Sep. 26, 2026. [Online]. Available: https://standards.ieee.org/ieee/802.3/10422/
[10]
“Intel 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture (253665-093US),” Intel Corporation, 2026. Accessed: Sep. 28, 2026. [Online]. Available: https://cdrdv2.intel.com/v1/dl/getContent/671436
[11]
“SOME/IP Protocol Specification (AUTOSAR FO R25-11),” AUTOSAR, 2025. Accessed: Sep. 28, 2026. [Online]. Available: https://www.autosar.org/fileadmin/standards/R25-11/FO/AUTOSAR_FO_PRS_SOMEIPProtocol.pdf
[12]
“Specification of Communication (AUTOSAR CP R25-11),” AUTOSAR, 2025. Accessed: Sep. 28, 2026. [Online]. Available: https://www.autosar.org/fileadmin/standards/R25-11/CP/AUTOSAR_CP_SWS_COM.pdf