Merge sort is a divide-and-conquer sorting algorithm that sorts an array by dividing it into two halves, sorting each half, and then merging the two halves back together in sorted order. This is done recursively until the sub-arrays are of size 1, at which point they are considered to be sorted. The merging step involves comparing the first elements of both arrays and taking the smaller one, adding it to a new array, and repeating until both arrays have been fully merged. This results in a sorted output array. The time complexity of merge sort is O(n log n), making it a highly efficient sorting algorithm for large datasets.