A novel protocol, measurement-device-independent quantum key distribution (MDI-QKD), removes all attacks from the detection system, the most vulnerable part in QKD implementations. In this paper, we present an analysis for practical aspects of MDI-QKD. To evaluate its performance, we study various error sources by developing a general system model. We find that MDI-QKD is highly practical and thus can be easily implemented with standard optical devices. Moreover, we present a simple analytical method with only two (general) decoy states for the finite decoy-state analysis. This method can be used directly by experimentalists to demonstrate MDI-QKD. By combining the system model with the finite decoy-state method, we present a general framework for the optimal choice of the intensities of the signal and decoy states. Furthermore, we consider a common situation, namely asymmetric BS U1 Alice U3 a b c d U2 PBS2 PBS1 SPD SPD ch dh cv WCP M M Charles/Eve Alice M Bob WCP P M M BS U3 3 B a b c d PBS2 SPD SPD ch dh dv cv Charles/Eve WCP Figure 1. MDI-QKD system model. WCP, weak coherent pulse; M, polarization and intensity modulators; BS, beam splitter; PBS, polarization BS; SPD, singlephoton detector. In MDI-QKD [14], each of Alice and Bob prepares BB84 states in combination with decoy states and sends them to an untrusted relay Charles (or Eve), who is supposed to perform a BSM. As an example, this figure considers a polarization-encoding scheme. Three unitary operators (U) are used to model the polarization misalignment (or rotation); PBS2 is defined as the fundamental measurement basis; U 1 (U 2 ) represents the polarization misalignment of Alice's (Bob's) channel transmission, while U 3 models the misalignment of the other measurement setting, PBS1. In the ideal case without any polarization misalignment, the rectilinear (Z ) basis, used for key generation in equation (1), refers to the basis of PBS1 and PBS2.